Application Startup Error


Author
Message
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Several of my users are randomly getting the following error:



Message: An error occurred while creating the main form



Source: MicroFour StrataFrame UI



Inner Exception: System.Reflection.TargetInvocationException: Exception

has been thrown by the target of an invocation. --->

System.IO.FileLoadException: Could not load file or assembly

'DevExpress.XtraNavBar.v8.2, Version=8.2.4.0, Culture=neutral,

PublicKeyToken=9b171c9fd64da1d1' or one of its dependencies. The process

cannot access the file because it is being used by another process.

(Exception from HRESULT: 0x80070020)



File name: 'DevExpress.XtraNavBar.v8.2, Version=8.2.4.0,

Culture=neutral, PublicKeyToken=9b171c9fd64da1d1'

at Aspire.SF.MainForm.InitializeComponent()

at Aspire.SF.MainForm..ctor()



It does not generate the error if the user tries to start the application again. It typically occurs after the application has updated itself (click once procedures). I realize that the assembly referenced is a DevEx assembly, but I was wondering if there was a way to check for this while starting the app and gracefully closing the app or restarting the app without the user getting the unhandled error message.



Thanks!

Bill
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Actually, there is probably nothing random about this.  The bottom line is that this assebmly cannot be located when called.  Either place this assembly in the path of your application or add it to the GAC and it will most likely resolve the issue.  The second part of this is to make sure that you are distributing the correct version of this assembly.
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I don't think it is a version issue, since the app runs great the second time the user tries to opens it. If the versions were conflicting, they would continue to conflict on each startup. I may be wrong about that one.



As far as the assemblies, these are dumped into the ClickOnce folder and accessed from there. The path looks something like this:



C:\Documents and Settings\bill\Local Settings\Apps\2.0\817QZGZ6.PWG\K0OQB3XD.G9T\deve..v8.2_9b171c9fd64da1d1_0008.0002_none_96e6134e9e8ec941\DevExpress.XtraNavBar.v8.2.dll



I am thinking that the assembly is kept open by the application before the update begins...so, when the update completes and the application restarts, the assembly is not released in a timely manner. That is what is generating the error. That's my best guess, anyway.



I'll see if I can trap this specific error and handle it differently from the UnhandledExceptionFound method of program.cs.



Thanks!

Bill
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Bill,



Is the update happening when the user starts the app, or are you initiating the update while the app is running, via the ClickOnce(more) API? Is this a web app?
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Hi Greg,



I have a small procedure that runs when the Windows Forms app opens to check to see if there is an update available (via ClickOnce structure). I then present a dialog to ask the user if they want to update. If so, the app goes out to the server to retrieve the update, then restarts itself with the new version. 98% of the time, the app restarts without a problem. The other 2% hiccups on the assembly mentioned. A second restart works fine.



I have introduced some trappings in my UnhandledExceptionFound method. Hopefully, those will detect the problem and automatically issue a restart.



If you have any other insight, I would appreciate it.



Thanks,

Bill
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
OK, well at least this makes sense. I wonder if putting a Thread.Sleep() call in there would help to give it time to unload the app (besides an error handling)? Not sure, just a thought.



Also, any reason why you are managing the update when the app opens, rather than just letting ClickOnce handle it?
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search