c# - using STAThread on ArcFM license -


I am trying to use ArcFM with ARGGIS project, and I have seen a bug I

if If my main thread is marked with the [STAThread] attribute, then the program hangs out with the OS loader lock exception, when I remove that feature, the program ends right away.
The following code hangs

  [STAThread] Private static zero main () {MMAppInitialize mmAppInitialize = new MMAPInitialize (); MmAppInitialize.IsProductCodeAvailable (mmLicensedProductCode.mmLPDesigner); }  

Has anyone here seen this before? Is there something that I'm doing wrong?
I have to think that I have to run on STAThread because otherwise all my COM instances will be killed with a different thread from the main thread.

My bugs were found -
It would work fine:

  [STAThread] Private static zero main () {MMAppInitialize mmAppInitialize = New MMAPInitialize (); MmAppInitialize.IsProductCodeAvailable (mmLicensedProductCode.mmLPDesigner); MmAppInitialize.Initialize (mmLicensedProductCode.mmLPDesigner); MmAppInitialize.Shutdown (); }  

There is still a small bug - it does not work:

  [STAThread] Private static zero main () {MMAppInitialize mmAppInitialize = New MMAPInInitialize (); MmAppInitialize.IsProductCodeAvailable (mmLicensedProductCode.mmLPDesigner); MmAppInitialize.Shutdown (); }  

Although this is not for a real use - just check for a license, without receiving it.

In my "real" code I was calling initialize and finally shutdown , but I found the locker lock exception because I later started the mmAppInitialize After switching AoAppInitialize order was closed, the program was finished properly.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -