S
Skin Diver
Here is an example of what looks to be a bug in the Compact Framework when
executing under Windows CE.
If you run it on XP, you get the right result. "Done. state=Finished".
If you run it on the emulator, you get the wrong result. "Done.
state=Inside the lock".
This is very strange, and could be very bad because part of finally code
won't be executed.
using System;
using System.Threading;
namespace ConsoleApplication9
{
class Program
{
static public string state = string.Empty;
private static readonly object theLock = new object();
static void Main(string[] args)
{
try
{
try
{
state = "Starting";
throw new Exception("Exception!!!");
}
finally
{
lock (theLock)
{
state = "Inside the lock";
}
state = "Finished";
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
Console.WriteLine("Done. state=" + state);
Thread.Sleep(Timeout.Infinite);
}
}
}
executing under Windows CE.
If you run it on XP, you get the right result. "Done. state=Finished".
If you run it on the emulator, you get the wrong result. "Done.
state=Inside the lock".
This is very strange, and could be very bad because part of finally code
won't be executed.
using System;
using System.Threading;
namespace ConsoleApplication9
{
class Program
{
static public string state = string.Empty;
private static readonly object theLock = new object();
static void Main(string[] args)
{
try
{
try
{
state = "Starting";
throw new Exception("Exception!!!");
}
finally
{
lock (theLock)
{
state = "Inside the lock";
}
state = "Finished";
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
Console.WriteLine("Done. state=" + state);
Thread.Sleep(Timeout.Infinite);
}
}
}