Bug 7435 - Issue with [ThreadStatic] attribute
Summary: Issue with [ThreadStatic] attribute
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 6.0.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-09-24 19:40 UTC by me
Modified: 2013-12-05 18:35 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description me 2012-09-24 19:40:31 UTC
I just upgraded to v6 monotouch, and i'm using MonoGame for iOS game development. deep in the innards of monogame, there is a class used for sprite fonts.


// static var declaration
private static Typesetter PerThreadTypesetter;

//the struct looks like this:
struct Typesetter {
			private SpriteFont _font;
			private float _width;
			private float _finalLineHeight;
			private int _fullLineCount;

			public bool HasCurrentGlyph;
			public Glyph CurrentGlyph;
			public Vector2 Offset;

// other functions happen after var declaration

the problem is whenever i try to set the value of the '_finalLineHeight' variable to anything but 0, i get this:

Native stacktrace:

	0   Beem                                0x0009865c mono_handle_native_sigsegv + 284
	1   Beem                                0x0000efe8 mono_sigsegv_signal_handler + 248
	2   libsystem_c.dylib                   0x9731559b _sigtramp + 43
	3   ???                                 0xffffffff 0x0 + 4294967295
	4   Beem                                0x001a7d12 single_arg_user_copy_or_mark + 34
	5   Beem                                0x001d1ea0 mark_tls_slots + 128
	6   Beem                                0x001ab460 scan_from_registered_roots + 336
	7   Beem                                0x001b75d6 major_collection + 2886
	8   Beem                                0x001b8318 mono_gc_collect + 88
	9   Beem                                0x00226ec6 monotouch_pump_gc + 38
	10  libsystem_c.dylib                   0x972bded9 _pthread_start + 335
	11  libsystem_c.dylib                   0x972c16de thread_start + 34

Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.

The [ThreadStatic] attribute screams red flag, so i commented it out, and everything appeared to work again (though i'm not sure what implications that has on MonoGame working, but so far so good).
Comment 1 Sebastien Pouliot 2012-09-24 19:46:39 UTC
I've seen something similar. What GC are you using, Boehm or sgen ?
Comment 2 me 2012-09-25 01:38:46 UTC
how do i tell?
Comment 3 Zoltan Varga 2012-09-25 04:13:04 UTC
Thats sgen.
This might be a regression caused by 41aae7f0bfb674692c2648018a52deec69022412.
Comment 4 PJ 2013-11-19 17:05:32 UTC
This bug has been in the NEEDINFO state with no changes for the last 90 days. Can we put this back into the NEW or CONFIRMED state, or are we still awaiting response?

If there is no change in the status of this bug over the next two weeks, this bug will be marked as NORESPONSE.
Comment 5 PJ 2013-12-05 18:35:58 UTC
This bug has not been changed from the NEEDINFO state since my previous comment, marking as RESOLVED NORESPONSE.

Please feel free to REOPEN this bug at any time if you are still experiencing the issue. Please add the requested information and set the bug back to the NEW (or CONFIRMED) state.