Bugzilla – Bug 324332
[PATCH] Thread.ApartmentState does not match MS 1.x
Last modified: 2007-09-15 21:24:46 UTC
---- Reported by gert.driesen@pandora.be 2007-05-17 11:23:11 MST ---- Our implementation of Thread.ApartmentState does not match that of MS 1.x. On .NET 1.x, the ApartmentState of the main thread should be initialized to Unknown if no STAThread attribute is applied to the main method. The same goes for thread's that are explicitly created. The attached patch fixes the behaviour for the 1.0 profile while respecting the current behaviour on the 2.0 profile. To reproduce, compile and run the attached code snippet on both 1.0 and 2.0 profile. Expected: 1.0 profile: MAIN: Unknown T1: Unknown T2: STA T3: MTA MAIN: Unknown 2.0 profile: MAIN: MTA T1: MTA T2: STA T3: MTA MAIN: MTA Actual result: 1.0 profile: MAIN: MTA T1: MTA T2: STA T3: MTA MAIN: MTA 2.0 profile: MAIN: MTA T1: MTA T2: STA T3: MTA MAIN: MTA ---- Additional Comments From gert.driesen@pandora.be 2007-05-17 11:24:05 MST ---- Created an attachment (id=171986) Repro ---- Additional Comments From gert.driesen@pandora.be 2007-05-17 11:31:42 MST ---- Created an attachment (id=171987) Fix + Changelog ---- Additional Comments From joncham@gmail.com 2007-05-17 12:03:33 MST ---- This looks like the correct behavior to me. Can some runtime developer approve that the version check is ok to do in that manner(I don't know a better way, but I want to make sure it's ok as I haven't seen many checks like that in the runtime)? ---- Additional Comments From robertj@gmx.net 2007-05-17 16:12:43 MST ---- Paulo told me to use this kind of runtime check for one of my patches, so I guess it's still okay. ---- Additional Comments From gert.driesen@pandora.be 2007-05-19 15:32:15 MST ---- Fixed in SVN (revision 77696). Imported an attachment (id=171986) Imported an attachment (id=171987)