On failure (if the app fails) - vb.net

I have an app and it fails randomly sometimes because my internet is not so fast (my app uses the webbrowser). How can I make my app restart itself it it fails? Or make my app click button1 on my form if it fails.

I have had similar problems in the past. I solved it by using scheduled tasks to start the app on a regular basis. On Startup the new version would attempt to stop the old version and if that failed, (because it was hung) it would kill the process of the old program.

Related

weblogic stop writing logs and shutdown

Maybe someone had the same problem.
I use Weblogic at work. So, we have two small applications on it. And today it stopped writing logs(all logs stopped writing at the same time). Then, after three hours it writes in log “JVM called WLS shutdown hook. The server will force shutdown now” and shutdown. After start everything works fine.
But I want to understand, why this situation happened
Thanks
This happens when System.exit(int) is called. Check if some of the deployed components call System.exit instead of throwing an Exception. This also can be due to the JVM taking up the OS signals.Set the -Xrs option in the startup scripts in JAVA_OPTIONS if you are using Sun JDK.It reduces use of operating-system signals by the JVM.

VB.NET Let message box linger after application quit

At a client of mine, in-house applications are all located on a network share. Users create shortcuts to the required applications from the network share so we can easily make sure everyone uses the latest version.
This works fairly well, although we often have an issue when users are still using applications when we'd like to release a new version. For most applications, we'd forcibly remove all the file locks on the server and release the new version. Not a very elegant solution, especially since we need assistance from another department for this.
For newer applications, I've developed a cleaner solution, where the application intermittently checks if it's still the most recent release. If it isn't, it shows a message to the user, asking him to quit the application at first convenience, or within 3 minutes. After 3 minutes, the application quits itself and all is well. However, some users will immediately try to re-start the application. The application will then show a simple MessageBox telling the user this version is currently not supported. My problem is this: while this MessageBox is visible, my executable is still locked.
I'm looking for any of the following solutions:
Releasing all locks on the current assembly files from within code
Showing a message box that lingers after the current assembly has exited
This is exactly precisely the problem that .NET ClickOnce deployment is meant to solve. Users have a shortcut they can click, the latest version is downloaded on application start, and there are no server-side executables to be locked if a user leaves their process open.
ClickOnce Deployment Overview
HowTo:Publish a ClickOnce Application

Changing a Launch Configuration while it's running

In this Eclipse RCP application I am making, when a new launch is made, it checks some details of the already running launches which are retrieved by DebugPlugin.getDefault().getLaunchManager().getLaunches().
If it has certain details of its configuration the same as any of the running launches, it should stop. Currently so far, so good.
The Issue
What happens when I edit a LaunchConfiguration while launches of its type are still ongoing? Will that change the attributes of all the running launches' launch configurations? (I am talking about what is retrieved by: ILaunch.getLaunchConfiguration() )
EDIT: More details: in this case it is a hardware connection, and the hardware can only receive one ongoing concurrent connection. If the launch configuration changes, and we check all of the running launches' configurations, we will be unable to check if we're launching for the same hardware twice
When I call ILaunch.getLaunchConfiguration().getAttribute(String,String) it retrieves the new value that has been changed DURING the launch.
So, yes, if an ILaunchConfiguration during an active ILaunch has some attributes changed, if there is no deep copy made in the ILaunch, the changes will reflect on the running ILaunch. Ugh.

How do I start a console application in one project from a web form in another project?

I have a website created in VS 2010 with .NET 4.0. There are multiple projects in the solution. In one of the projects I have a form that gives a user the option to run a console application that is in another project of the solution. (called update.exe)
I have tried just using
process.start(filepath + "update.exe")
but it doesn't seem to run.
It finds the file but then finishes immediately. I tried adding Console.readKey() to the console application so it would stay open after being called, but it was to no avail.
On top of this, I know that the console app isn't running as I have logs set up throughout the console's code and it never even seems to kick off.
Should I be calling the console app differently? (note: I am writing in VB.net)
Thanks!
Purely speculative here.. but my guess is that when the page finishes processing the process is terminated. Try having the page wait for the process to close.
My 'work-around' for a similar requirement is this:
Use the ASP page to create a CMD or BAT file on the server.
Create/write a service that 'watches' for the CMD/BAT file - and when it finds one, it runs it. The service can be written to start a process as a user.

Is manually (and silently) updating a ClickOnce app going to be a stable way of deploying updates?

I've deployed an application inside a corporate network and I want the update process to require less attention from users, similar to how Google Chrome install updates - in the background. I don't need to give the user a choice to update.
I've used the System.Deployment library to detect when new ClickOnce updates are available and install them automatically. I'm wondering if its necessary to restart the app after the update is complete. Currently I invoke Application.Restart() at the end of my update script.
But what if (to make the update process more transparent for the user) I performed a 'silent' async update and then displayed an icon prompting the user to restart the app to apply the changes? Would this make the app unstable in any way?
Furthermore, if I ran my custom InstallUpdate() process on a timer, say every 30 minutes, would ClickOnce be stable to continue to update for every new version that was released even thought the user has not restarted (nb: I'm expecting the updates to only apply once the user restarts the app)?
I would think it depends on what your application does at startup, and what it's doing when the update is installed and the application is restarted, and what the update contains. You could try running it and then attaching a debugger to it and see what it's doing and what impact it has.
For example, our application loads a lot of information into memory when it starts up. If the update included a change to one of the data structures, and the app didn't reload the data for some reason, it would cause a problem.
After a few years of doing it like this, we have found that it is possible to silently install updates this way. However there are a few issues to be aware of:
If the thread terminates prematurely during the Update() (eg: the user exits out of the app while the updating is in progress), the install will become corrupt and the next time the user loads the app, the ClickOnce normal deployment will fire off and re-install the app.
The user's desktop icons always redraw (flicker) after an update is installed.
Calling ApplicationDeployment.CurrentDeployment.CheckForUpdate() more than 65536 times causes a System.NullReferenceException Source.
An alternative is not to actually check for an update, I have found that this locks one of my dlls and prevented a form from loading, so use with care:
If ApplicationDeployment.CurrentDeployment.Update Then ' update app
console.writeline("update installed")
' code to inform user update was sucessfull and they need to restart
End If
If your ClickOnce project is 32bit, and you run it on an x64 platform, any file associations your app has will break after performing a manual ClickOnce update. See this MS support case for more details.