.net - When to Set ThreadApartmentState when using Component that is exposed to VB6 -
i have com component fixing @ moment used within vb6 application (and raises events) hosting vb6 program. this component uses multiple threads perform it's work internally , moves events out layer exposed vb6 application. in constructor of component called via vb6 application (new myobject) block of code within component gets called public sub new() msynccontext = system.threading.synchronizationcontext.current if msynccontext nothing using f new windows.forms.form msynccontext = system.threading.synchronizationcontext.current end using end if end sub within threads raiseevents received in outer object. the events find way commscommunicationserror , tricks onto correct thread raising events visualbasic6. private sub commscommunicationserror(byval theerrornumber integer, byval theorder order) mrecordingcounter += 1 dim args ordererroreventargs if theorder.parent isnot nothing args = new ordererroreventargs(theerrornumber, theo...