[Mono-list] why does gmcs let me assign null to a value type?

Eric Slosser eric.slosser at v-fx.com
Thu Jan 6 11:48:28 EST 2011

On Jan 6, 2011, at 10:55 AM, Eric Slosser wrote:

> The problem is that downstream of 'f = null', we have code that does 'f == null' and 'f != null', which does one thing under .NET and another under Mono.  That's no fun.

I am happy to say I was wrong about the above.  Given this code:

	Field f = null;
	Console.WriteLine("{0} {1}", f==null, f!=null );

When compiled by Mono, the output is "false true". 
When compiled by VisStudio, the output is "true false".

It doesn't matter whether the compiled code is run under .Net or Mono, just who did the compiling.

So I can use the assemblies produced by VisStudio and get the 'expected' behavior.  

My only problem with that approach is that I've never been able to get MonoDevelop to step through code that it didn't compile.  Is that possible?

More information about the Mono-list mailing list