Application.Restart on ClickOnce Deployed Application

G

Guest

We've got an application that we deploy with click once.
Using the MyApplication_UnhandledException we restart the application with
Windows.Forms.Application.Restart() if the user encounters an error we
didn't catch.

Our application allows paramaters to be passed to the ClickOnce Application
We are retrieving these like this..
If My.Application.IsNetworkDeployed Then
Dim zUri As New
Uri(My.Application.Deployment.ActivationUri.AbsoluteUri)
zstrQuery = zUri.Query
zarr_strArgs = zstrQuery.Split("&".ToCharArray)
Else....

This works fine when the appliciation is started the first time. After a
restart though, it appears that there is no ActivationUri.AbsoluteUri and I
recieve an "Object reference not set to an instance of an object" error.

What's going on? The documentation states,
"Applications are restarted in the context in which they were initially run.
If your application was started using a URL pointing directly to the
application's main executable file, it will be restarted using the same URL.
If your application is a ClickOnce application, it will be restarted using
ClickOnce.

If your application was originally supplied command-line options when it
first executed, Restart will launch the application again with the same
options."

The way I read this, it should activate the same way it did the first time,
so why is there no Uri?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top