Home All Groups Group Topic Archive Search About

Debugging a ClickOnce web-deployed app

Author
19 May 2009 8:41 PM
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

Author
20 May 2009 8:14 AM
Cor Ligthert[MVP]
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

Show quoteHide quote
"Andrew Raastad" <notgi***@email.com> wrote in message
news:A53D230C-7653-4B95-A549-D1A23C179EB7@microsoft.com...
> 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
>
>
Author
20 May 2009 7:05 PM
Andrew Raastad
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



Show quoteHide quote
"Cor Ligthert[MVP]" <Notmyfirstn***@planet.nl> wrote in message
news:%23dBdeMS2JHA.4632@TK2MSFTNGP02.phx.gbl...
> 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 Raastad" <notgi***@email.com> wrote in message
> news:A53D230C-7653-4B95-A549-D1A23C179EB7@microsoft.com...
>> 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
>>
>>
>
Author
20 May 2009 8:23 PM
Armin Zingler
Andrew Raastad wrote:
> 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
Author
21 May 2009 3:16 PM
Andrew Raastad
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


Show quoteHide quote
"Cor Ligthert[MVP]" <Notmyfirstn***@planet.nl> wrote in message
news:%23dBdeMS2JHA.4632@TK2MSFTNGP02.phx.gbl...
> 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 Raastad" <notgi***@email.com> wrote in message
> news:A53D230C-7653-4B95-A549-D1A23C179EB7@microsoft.com...
>> 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
>>
>>
>