Bug 324332 (MONO81656) - [PATCH] Thread.ApartmentState does not match MS 1.x
Summary: [PATCH] Thread.ApartmentState does not match MS 1.x
Status: RESOLVED FIXED
Alias: MONO81656
Product: Mono: Runtime
Classification: Mono
Component: misc (show other bugs)
Version: 1.2
Hardware: Other All
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-17 18:23 UTC by Gert Driesen
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Repro (726 bytes, text/plain)
2007-05-17 18:24 UTC, Thomas Wiest
Details
Fix + Changelog (2.86 KB, patch)
2007-05-17 18:31 UTC, Thomas Wiest
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:38:58 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)