Page 1 of 1

.NET Profiler sets the ApartmentState of my Process

Posted: Tue Aug 30, 2005 12:38 pm
by Sascha Fueller

our application should use the SingleThreadedApartment for COM-Interop.
Till now we used the STAThreadAttribute.
For some other reasons we now have to set the ApartmentState-Property in the Main-Method, so the Attribute isn't used anymore.

This works fine. But when I start the process from profiler, then the apartment state gets multithreaded. I think it is because profiling code is executed before our code is called.

Is there any possibility to set the appertment state in code and using profiling?


Posted: Tue Aug 30, 2005 9:27 pm
by Andreas Suurkuusk
This is a known issue. After the first GC the profiler initializes the COM apartment (if not already initialized). We will try to fix this in version 2.6 of the profiler.