Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Debugging a ClickOnce web-deployed app

Reply
 
Old 05-19-2009   #1 (permalink)
Andrew Raastad


 
 

Debugging a ClickOnce web-deployed app

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


My System SpecsSystem Spec
Old 05-20-2009   #2 (permalink)
Cor Ligthert[MVP]


 
 

Re: Debugging a ClickOnce web-deployed app

Andrew,

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

Cor

"Andrew Raastad" <notgiven@xxxxxx> wrote in message
news:3342FAEF-6644-4B06-A5DE-885B1E941928@xxxxxx
Quote:

> 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
>
My System SpecsSystem Spec
Old 05-21-2009   #3 (permalink)
Andrew Raastad


 
 

Re: Debugging a ClickOnce web-deployed app

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" <notgiven@xxxxxx> wrote in message
news:FF09403A-84D4-4F46-A314-323A62A38E39@xxxxxx
Quote:

>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]" <Notmyfirstname@xxxxxx> wrote in message
> news:eR8OYUS2JHA.6056@xxxxxx
Quote:

>> Andrew,
>>
>> Please don't multipost I have given a solution in another newsgroup
>>
>> Cor
>>
>> "Andrew Raastad" <notgiven@xxxxxx> wrote in message
>> news:3342FAEF-6644-4B06-A5DE-885B1E941928@xxxxxx
Quote:

>>> 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
>>>
>>
>
My System SpecsSystem Spec
Old 05-22-2009   #4 (permalink)
Gloops


 
 

Re: Debugging a ClickOnce web-deployed app

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 :
Quote:

> 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" <notgiven@xxxxxx> wrote in message
> news:FF09403A-84D4-4F46-A314-323A62A38E39@xxxxxx
Quote:

>> 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]" <Notmyfirstname@xxxxxx> wrote in message
>> news:eR8OYUS2JHA.6056@xxxxxx
Quote:

>>> Andrew,
>>>
>>> Please don't multipost I have given a solution in another newsgroup
>>>
>>> Cor
>>>
>>> "Andrew Raastad" <notgiven@xxxxxx> wrote in message
>>> news:3342FAEF-6644-4B06-A5DE-885B1E941928@xxxxxx
>>>> 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
>>>>
>>>
>>
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Printer deployed through GPO cannot be deleted General Discussion
Change icon of clickonce deployed program .NET General
Media player 11 stopped working after the auto-updates deployed ye Vista music pictures video
Printers deployed through GPO not removed Vista print fax & scan
Printers deployed from WS2003 R2 server Vista print fax & scan


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46