PC Review


Reply
Thread Tools Rate Thread

Debugging a ClickOnce web-deployed app

 
 
Andrew Raastad
Guest
Posts: n/a
 
      19th May 2009
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

 
Reply With Quote
 
 
 
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      20th May 2009
Andrew,

Please don't multipost I have given a solution in another newsgroup

Cor

"Andrew Raastad" <(E-Mail Removed)> wrote in message
news:3342FAEF-6644-4B06-A5DE-(E-Mail Removed)...
> 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
>


 
Reply With Quote
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      20th May 2009
Andrew,

Please don't multipost I have given a solution in another newsgroup

Cor

"Andrew Raastad" <(E-Mail Removed)> wrote in message
news:3342FAEF-6644-4B06-A5DE-(E-Mail Removed)...
> 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
>


 
Reply With Quote
 
Andrew Raastad
Guest
Posts: n/a
 
      20th May 2009
I posted the question in here to catch those who may not read/subscribe to
the other newsgroup. I am NOT spamming, simply trying to find those who may
be able to help.

Now, as your suggestion in the other newsgroup, that of using VS to Attach
to Process gave the same result as that which I mentioned in my post... do
you, or anyone else in here, have other suggestions on how to debug an
application after it has been published via ClickOnce and from that
perspective all you have is the .exe file? (the .pdb and other debug stuff
you get while still building the app does not get published via ClickOnce,
yet the program is not erroring until it is published).

-- Andrew





"Cor Ligthert[MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Andrew,
>
> Please don't multipost I have given a solution in another newsgroup
>
> Cor
>
> "Andrew Raastad" <(E-Mail Removed)> wrote in message
> news:3342FAEF-6644-4B06-A5DE-(E-Mail Removed)...
>> 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
>>

>


 
Reply With Quote
 
Andrew Raastad
Guest
Posts: n/a
 
      20th May 2009
I posted the question in here to catch those who may not read/subscribe to
the other newsgroup. I am NOT spamming, simply trying to find those who may
be able to help.

Now, as your suggestion in the other newsgroup, that of using VS to Attach
to Process gave the same result as that which I mentioned in my post... do
you, or anyone else in here, have other suggestions on how to debug an
application after it has been published via ClickOnce and from that
perspective all you have is the .exe file? (the .pdb and other debug stuff
you get while still building the app does not get published via ClickOnce,
yet the program is not erroring until it is published).

-- Andrew





"Cor Ligthert[MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Andrew,
>
> Please don't multipost I have given a solution in another newsgroup
>
> Cor
>
> "Andrew Raastad" <(E-Mail Removed)> wrote in message
> news:3342FAEF-6644-4B06-A5DE-(E-Mail Removed)...
>> 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
>>

>


 
Reply With Quote
 
Andrew Raastad
Guest
Posts: n/a
 
      21st May 2009
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


"Andrew Raastad" <(E-Mail Removed)> wrote in message
news:FF09403A-84D4-4F46-A314-(E-Mail Removed)...
>I posted the question in here to catch those who may not read/subscribe to
>the other newsgroup. I am NOT spamming, simply trying to find those who
>may be able to help.
>
> Now, as your suggestion in the other newsgroup, that of using VS to Attach
> to Process gave the same result as that which I mentioned in my post... do
> you, or anyone else in here, have other suggestions on how to debug an
> application after it has been published via ClickOnce and from that
> perspective all you have is the .exe file? (the .pdb and other debug stuff
> you get while still building the app does not get published via ClickOnce,
> yet the program is not erroring until it is published).
>
> -- Andrew
>
>
>
>
>
> "Cor Ligthert[MVP]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Andrew,
>>
>> Please don't multipost I have given a solution in another newsgroup
>>
>> Cor
>>
>> "Andrew Raastad" <(E-Mail Removed)> wrote in message
>> news:3342FAEF-6644-4B06-A5DE-(E-Mail Removed)...
>>> 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
>>>

>>

>


 
Reply With Quote
 
Andrew Raastad
Guest
Posts: n/a
 
      21st May 2009
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


"Andrew Raastad" <(E-Mail Removed)> wrote in message
news:FF09403A-84D4-4F46-A314-(E-Mail Removed)...
>I posted the question in here to catch those who may not read/subscribe to
>the other newsgroup. I am NOT spamming, simply trying to find those who
>may be able to help.
>
> Now, as your suggestion in the other newsgroup, that of using VS to Attach
> to Process gave the same result as that which I mentioned in my post... do
> you, or anyone else in here, have other suggestions on how to debug an
> application after it has been published via ClickOnce and from that
> perspective all you have is the .exe file? (the .pdb and other debug stuff
> you get while still building the app does not get published via ClickOnce,
> yet the program is not erroring until it is published).
>
> -- Andrew
>
>
>
>
>
> "Cor Ligthert[MVP]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Andrew,
>>
>> Please don't multipost I have given a solution in another newsgroup
>>
>> Cor
>>
>> "Andrew Raastad" <(E-Mail Removed)> wrote in message
>> news:3342FAEF-6644-4B06-A5DE-(E-Mail Removed)...
>>> 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
>>>

>>

>


 
Reply With Quote
 
Gloops
Guest
Posts: n/a
 
      22nd May 2009
Hello Andrew,

What about creating a variable that would inform you about the line
being executed ? A try / catch would enable you to display this
variable, further to the exception text.

This will tell you what line threw an error, and what error it was.
Already a good beginning in the direction of debugging, no ?



I did not very carefully look in the help whether this is already
implemented by the exception object, otherwise in the spirit, it could
look like something like that :

Public ReadOnly Property WebsiteName() As String
Dim ierl As Int = 1
Get
ierl = 2
Dim queryString As NameValueCollection = GetQueryStringParameters()
ierl = 3
Dim URL As String = ""
ierl = 4
If queryString.HasKeys Then
ierl = 5
Dim protocol As String = queryString("prot").Trim()
ierl = 6
Dim server As String = queryString("server").Trim()
ierl = 7
URL = protocol & "//" & server
ierl = 8
End If
ierl = 9
Return URL
ierl = 10
End Get
End Property


______________________________________________
Andrew Raastad a écrit, le 21/05/2009 17:16 :
> 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
>
>
> "Andrew Raastad" <(E-Mail Removed)> wrote in message
> news:FF09403A-84D4-4F46-A314-(E-Mail Removed)...
>> I posted the question in here to catch those who may not
>> read/subscribe to the other newsgroup. I am NOT spamming, simply
>> trying to find those who may be able to help.
>>
>> Now, as your suggestion in the other newsgroup, that of using VS to
>> Attach to Process gave the same result as that which I mentioned in my
>> post... do you, or anyone else in here, have other suggestions on how
>> to debug an application after it has been published via ClickOnce and
>> from that perspective all you have is the .exe file? (the .pdb and
>> other debug stuff you get while still building the app does not get
>> published via ClickOnce, yet the program is not erroring until it is
>> published).
>>
>> -- Andrew
>>
>>
>>
>>
>>
>> "Cor Ligthert[MVP]" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Andrew,
>>>
>>> Please don't multipost I have given a solution in another newsgroup
>>>
>>> Cor
>>>
>>> "Andrew Raastad" <(E-Mail Removed)> wrote in message
>>> news:3342FAEF-6644-4B06-A5DE-(E-Mail Removed)...
>>>> 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
>>>>
>>>

>>

>



 
Reply With Quote
 
Gloops
Guest
Posts: n/a
 
      22nd May 2009
Hello Andrew,

What about creating a variable that would inform you about the line
being executed ? A try / catch would enable you to display this
variable, further to the exception text.

This will tell you what line threw an error, and what error it was.
Already a good beginning in the direction of debugging, no ?



I did not very carefully look in the help whether this is already
implemented by the exception object, otherwise in the spirit, it could
look like something like that :

Public ReadOnly Property WebsiteName() As String
Dim ierl As Int = 1
Get
ierl = 2
Dim queryString As NameValueCollection = GetQueryStringParameters()
ierl = 3
Dim URL As String = ""
ierl = 4
If queryString.HasKeys Then
ierl = 5
Dim protocol As String = queryString("prot").Trim()
ierl = 6
Dim server As String = queryString("server").Trim()
ierl = 7
URL = protocol & "//" & server
ierl = 8
End If
ierl = 9
Return URL
ierl = 10
End Get
End Property


______________________________________________
Andrew Raastad a écrit, le 21/05/2009 17:16 :
> 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
>
>
> "Andrew Raastad" <(E-Mail Removed)> wrote in message
> news:FF09403A-84D4-4F46-A314-(E-Mail Removed)...
>> I posted the question in here to catch those who may not
>> read/subscribe to the other newsgroup. I am NOT spamming, simply
>> trying to find those who may be able to help.
>>
>> Now, as your suggestion in the other newsgroup, that of using VS to
>> Attach to Process gave the same result as that which I mentioned in my
>> post... do you, or anyone else in here, have other suggestions on how
>> to debug an application after it has been published via ClickOnce and
>> from that perspective all you have is the .exe file? (the .pdb and
>> other debug stuff you get while still building the app does not get
>> published via ClickOnce, yet the program is not erroring until it is
>> published).
>>
>> -- Andrew
>>
>>
>>
>>
>>
>> "Cor Ligthert[MVP]" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Andrew,
>>>
>>> Please don't multipost I have given a solution in another newsgroup
>>>
>>> Cor
>>>
>>> "Andrew Raastad" <(E-Mail Removed)> wrote in message
>>> news:3342FAEF-6644-4B06-A5DE-(E-Mail Removed)...
>>>> 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
>>>>
>>>

>>

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Debugging a ClickOnce web-deployed app Andrew Raastad Microsoft VB .NET 8 21st May 2009 04:16 PM
Debugging a ClickOnce web-deployed app Andrew Raastad Microsoft VB .NET 0 19th May 2009 09:41 PM
Debugging a ClickOnce web-deployed app Andrew Raastad Microsoft Dot NET 0 19th May 2009 09:40 PM
Debugging a ClickOnce deployed application Tom Jones Microsoft C# .NET 2 12th Apr 2007 10:49 PM
Can ClickOnce deployed app use C++/COM dlls? Ulrik Microsoft Dot NET Framework 0 12th Jan 2005 08:20 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:46 PM.