
Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
> >Try running the following code (tested on .Net1.1 SP1) in both debug and
> >release builds. Notice the different results:
>
> I can't repro it, here it prints the expected result in both builds.
Have you tried compiling it from the command line? Here are my results:
c:\test>csc /debug+ Test.cs
Microsoft (R) Visual C# .NET Compiler version 7.10.6001.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
c:\test>test
ABC
XYZ
c:\test>csc /debug- /o+ Test.cs
Microsoft (R) Visual C# .NET Compiler version 7.10.6001.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
c:\test>test
ABC
ABC
It seems to be okay with .NET 2.0 though.
I must say, I'm very surprised by this - I haven't seen anything
similar before.
I'll raise this with MS personally...

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Mattias Sjögren - 15 Nov 2005 17:39 GMT
>Have you tried compiling it from the command line?
Yup that's what I did, but I may have forgotten /o or ran the wrong
executable or some other stupid mistake. My bad.
Mattias

Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Metallikanz! - 27 Nov 2005 07:06 GMT
The problem is not reproducible from VS (2003, 1.1 SP1) even in the retail build with the optimization thingie on.
But when we use csc it sure does come, the inconsistency baffles me!!
Metallikanz!
Mattias Sjögren <mattias.dont.want.spam@mvps.org> wrote:
> >Try running the following code (tested on .Net1.1 SP1) in both debug and
> >release builds. Notice the different results:
>
> I can't repro it, here it prints the expected result in both builds.
Have you tried compiling it from the command line? Here are my results:
c:\test>csc /debug+ Test.cs
Microsoft (R) Visual C# .NET Compiler version 7.10.6001.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
c:\test>test
ABC
XYZ
c:\test>csc /debug- /o+ Test.cs
Microsoft (R) Visual C# .NET Compiler version 7.10.6001.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.
c:\test>test
ABC
ABC
It seems to be okay with .NET 2.0 though.
I must say, I'm very surprised by this - I haven't seen anything
similar before.
I'll raise this with MS personally...

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Mattias Sjögren - 28 Nov 2005 22:37 GMT
>The problem is not reproducible from VS (2003, 1.1 SP1) even in the retail build with the optimization thingie on.
If you launch from VS make sure you use "Start without debugging".
Otherwise the app will start with the debugger attached which changes
the JIT behavior.
Mattias

Signature
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.