Debugging a ClickOnce web-deployed app

  • Thread starter Thread starter Andrew Raastad
  • Start date Start date
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
 
Andrew,

With the Attach to process in the tab Debug you can attach an exe/dll to
your visual studio project and then debug it.

Cor
 
Andrew,

With the Attach to process in the tab Debug you can attach an exe/dll to
your visual studio project and then debug it.

Cor
 
Run the app, open VS2k8, Debug --> Attach to Process, find the app in the
list, click Attach and....

All I get is a single window with: "(Disassembly cannot be displayed in run
mode.)"


Any other ideas?


-- Andrew
 
Run the app, open VS2k8, Debug --> Attach to Process, find the app in the
list, click Attach and....

All I get is a single window with: "(Disassembly cannot be displayed in run
mode.)"


Any other ideas?


-- Andrew
 
Andrew said:
Run the app, open VS2k8, Debug --> Attach to Process, find the app in
the list, click Attach and....

All I get is a single window with: "(Disassembly cannot be displayed
in run mode.)"


Any other ideas?

Press Ctrl+Break?


Armin
 
Andrew said:
Run the app, open VS2k8, Debug --> Attach to Process, find the app in
the list, click Attach and....

All I get is a single window with: "(Disassembly cannot be displayed
in run mode.)"


Any other ideas?

Press Ctrl+Break?


Armin
 
Thanks to all who offered suggestions. I have been able to solve the
problems I was having, though I never could get the debugging aspect to
work. Had to resort to message boxes to display variable values at certain
places to find the problem I was encountering. I would, however, still like
to know how you are supposed to debug an application after it has been
compiled and completely separate from the Visual Studio environment.

-- Andrew
 
Thanks to all who offered suggestions. I have been able to solve the
problems I was having, though I never could get the debugging aspect to
work. Had to resort to message boxes to display variable values at certain
places to find the problem I was encountering. I would, however, still like
to know how you are supposed to debug an application after it has been
compiled and completely separate from the Visual Studio environment.

-- Andrew
 
Back
Top