A
Andrew Raastad
Running into an error I can't figure out.... Have an application that is to
be deployed via ClickOnce and set to "application is available online only".
Before I published it, I tested it out, debugged, the whole 9 yards, and all
worked smooth as can be. But once I publish/deploy it and run it, I am
getting an "Object Reference not set to an instance of an object" error.
Shortly after the app runs, the following property value is requested:
Public ReadOnly Property WebsiteName() As String
Get
Dim queryString As NameValueCollection =
GetQueryStringParameters()
Dim URL As String = ""
If queryString.HasKeys Then
Dim protocol As String = queryString("prot").Trim()
Dim server As String = queryString("server").Trim()
URL = protocol & "//" & server
End If
Return URL
End Get
End Property
The GetQueryStringParameters() function is as follows:
Private Function GetQueryStringParameters() As NameValueCollection
Dim nameValueTable As NameValueCollection = New
NameValueCollection()
Dim instance As ApplicationDeployment
Try
If (ApplicationDeployment.IsNetworkDeployed) Then
instance = ApplicationDeployment.CurrentDeployment
If Not IsNothing(instance) Then
Dim activateUri As Uri = instance.ActivationUri
If activateUri IsNot Nothing AndAlso activateUri.Query
<> String.Empty Then
nameValueTable =
System.Web.HttpUtility.ParseQueryString(activateUri.Query)
End If
End If
End If
Catch ex As Exception
Throw New Exception("BizLogic:GetQueryStringParameters()
Failed:" & vbCrLf & ex.ToString)
End Try
Return nameValueTable
End Function
When I run/debug the app from Visual Studio, the
ApplicationDeployment.IsNetworkDeployed returns FALSE so the above function
never fully executes, it just returns a blank string. But when I
publish/deploy the app, now that IF...THEN block does execute yet something
inside it is throwing that Null Object error and I don't know what.
I have tried using "System.Diagnostics.Debugger.Launch()" to get an instance
of Visual Studio to let me debug, but when Visual Studio opens up, I get a
warning message: "No symbols are loaded for any call stack frame. The source
code cannot be displayed." and the only thing I can look at is the
disassembly which looks like Machine Code.
Any help is greatly appreciated. Thanks!
-- Andrew
be deployed via ClickOnce and set to "application is available online only".
Before I published it, I tested it out, debugged, the whole 9 yards, and all
worked smooth as can be. But once I publish/deploy it and run it, I am
getting an "Object Reference not set to an instance of an object" error.
Shortly after the app runs, the following property value is requested:
Public ReadOnly Property WebsiteName() As String
Get
Dim queryString As NameValueCollection =
GetQueryStringParameters()
Dim URL As String = ""
If queryString.HasKeys Then
Dim protocol As String = queryString("prot").Trim()
Dim server As String = queryString("server").Trim()
URL = protocol & "//" & server
End If
Return URL
End Get
End Property
The GetQueryStringParameters() function is as follows:
Private Function GetQueryStringParameters() As NameValueCollection
Dim nameValueTable As NameValueCollection = New
NameValueCollection()
Dim instance As ApplicationDeployment
Try
If (ApplicationDeployment.IsNetworkDeployed) Then
instance = ApplicationDeployment.CurrentDeployment
If Not IsNothing(instance) Then
Dim activateUri As Uri = instance.ActivationUri
If activateUri IsNot Nothing AndAlso activateUri.Query
<> String.Empty Then
nameValueTable =
System.Web.HttpUtility.ParseQueryString(activateUri.Query)
End If
End If
End If
Catch ex As Exception
Throw New Exception("BizLogic:GetQueryStringParameters()
Failed:" & vbCrLf & ex.ToString)
End Try
Return nameValueTable
End Function
When I run/debug the app from Visual Studio, the
ApplicationDeployment.IsNetworkDeployed returns FALSE so the above function
never fully executes, it just returns a blank string. But when I
publish/deploy the app, now that IF...THEN block does execute yet something
inside it is throwing that Null Object error and I don't know what.
I have tried using "System.Diagnostics.Debugger.Launch()" to get an instance
of Visual Studio to let me debug, but when Visual Studio opens up, I get a
warning message: "No symbols are loaded for any call stack frame. The source
code cannot be displayed." and the only thing I can look at is the
disassembly which looks like Machine Code.
Any help is greatly appreciated. Thanks!
-- Andrew