0

I have inherited a VB.Net Web Application and I am having a weird issue compiling the code. I have recently patched the environment to VS 2012 SP 1 Update 4 and I am still having a problem.

Within a class file I have the following snippet:

Imports Microsoft.VisualBasic

Public Class SessionState

Public Shared Property MEASearchResults As Data.DataSet
    Get
        Return HttpContext.Current.Session.Item("MEASearchResults")
    End Get
    Set(ByVal value As Data.DataSet)
        If value Is Nothing Then
            HttpContext.Current.Session.Remove("MEASearchResults")
        Else
            HttpContext.Current.Session.Item("MEASearchResults") = value
        End If
    End Set
End Property

and a bunch more code and the following:

Public Shared Property MEAModelRejectCostListResults As Data.DataSet
    Get
        Return HttpContext.Current.Session.Item("MEAModelRejectCostListResults")
    End Get
    Set(ByVal value As Data.DataSet)
        If value Is Nothing Then
            HttpContext.Current.Session.Remove("MEAModelRejectCostListResults")
        Else
            HttpContext.Current.Session.Item("MEAModelRejectCostListResults") = value
        End If
    End Set
End Property

The weird issue I am having is that on the second definition of the Property as a Data.Dataset I am getting a Type 'Data.DataSet' is not defined compiler error message.

The issue I find perplexing is that the same declaration at the top of class file compiles cleanly.

Also, if I try and add System to the References for this web project, I get an error message indicating "The Web Site is already referencing the assembly 'System'"

I'm kind of stumped, any ideas?

kevin
  • 65
  • 10
  • Looks like a namespace conflict. Try adding reference and importing namespace System.Data. Then rewrite the code like this: `Public Shared Property MEAModelRejectCostListResults As DataSet`. – Han Jun 18 '16 at 00:26
  • Hi, I've tried adding a reference and as I mentioned above, it simply returns a message indicating that the Web Site already is referencing System.Data – kevin Jun 20 '16 at 15:38
  • Have you tried rewriting the code as I suggested? – Han Jun 21 '16 at 01:12
  • I have had to rewrite a bunch of code similar to your suggestion, I was trying to determine what the actual problem was because this was working on another developer's machine but for some reason on mine, I needed to add the Imports statements and variable declarations in a number of scenarios – kevin Jun 21 '16 at 16:04

0 Answers0