Re: Serious bug in .NET framework 2.0 - Finally the solution

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Elmue" <abuse@xxxxxx> wrote in message
news:OAdVCNdUGHA.2276@xxxxxxxxxxxxxxxxxxxxxxx
| Hi
|
| Finally I solved the problem without the help of this newsgroup.
| Here is the solution for all those, who encounter a problem of the
following kind:
|
| If you should find,
| -- that your application crashes in a strange way (no try .. catch helps)
| -- may be the crashes look different each time and seem unreproducable
| -- that the function which crashes your appplication uses COM (e.g.
IShellLink)
| -- that you compiled with Visual Studio 2003 for Framework 1.1
| -- that your application runs perfectly if ONLY framework 1.1 is
installed.
| -- that your application crashes if you ADDITIONALLY install framework 2.0
| -- that your application STILL crashes EVEN after you UNINSTALLED
framework 2.0
| then this tip might help you:
|
| If you call the function which accesses COM
| (no matter if in C# via COM import or in managed C++)
| from a thread then you must write:
|
| Thread i_COMThread = new Thread(new ThreadStart(ThreadProc));
| i_COMThread.ApartmentState = ApartmentState.STA;
| i_COMThread.Start();
|
| and the sun will shine again !!
|
| Elmü
|

Can you also explain why it failed after you installed V2 of the framework?
Threads enter the MTA unless you initialized them otherwise, this behavior
did not change from V1 to V2. Also why are you suggesting to initialize all
your threads that use COM interop to enter the STA? Threads should use a COM
component's compatible apartment (STA or MTA). If you initialize a thread to
enter a STA and your COM component is 'Free' threaded, you'll take a huge
marshaling overhead and the sun will shine less brightly ;-).

Willy.





.



Relevant Pages

  • Re: Bitter about [Lack of] .Net Framework Deployment
    ... We built a very nice auto-update framework, ... the 30-60 minute range to install. ... Also, the user's perception is reality - and our app install sucks, ... deploying 3.0 application, so I've not paid that close attention. ...
    (microsoft.public.dotnet.framework)
  • Re: Conversion from 2008->2003?
    ... required and install only those, you've not solved the problem of a new .NET ... app that uses a namespace or class you didn't know about when you did the ... Many people have perfectly legitimate reasons for ... If some of the code is being compiled against the 3.5 Framework, ...
    (microsoft.public.dotnet.general)
  • Re: userName="machine" didnt work
    ... to unregister my 1.1 framework do you? ... ASP.NET and .Net Framework versions installed? ... Neither of them have a user specified in their processModel. ... Did you install ASP.NET from SBS disks? ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: ServiceModelReg fails in installation of WCF
    ... file from a system on which 3.5 framework, ... (those people had to format the whole OS and then install this 3.5 ... securityInformation, SecurityIdentifier owner, SecurityIdentifier ... streamName, Boolean success, Object writeContext, Boolean ...
    (microsoft.public.dotnet.framework)
  • Re: building my .exe can it run anywhere?
    ... Then there are those who have a very fast ADSL connection ... I agree that it is probably safe to target framework 2.0 these days. ... At the end of the day, the question is: What is the .Net Framework ... if it is not installed download and install this from the MS website ...
    (microsoft.public.dotnet.languages.vb)