icsharpcode/ILSpy — Issue #319: Incorrect object declaration/locks
Author: Duikmeester
Created: 2012-03-09 10:25:08+00:00
State: open

```csharp
bool flag = false;

try
{
System.Threading.Monitor.Enter(this.lockObject, ref flag);
//etc...
}
finally
{
System.Threading.Monitor.Exit(this.lockObject);
}
```

gets decompiled into:

```csharp
bool flag = false;

try
{
object obj;
System.Threading.Monitor.Enter(obj = this.lockObject, ref flag);
//etc...
}
finally
{
object obj;
System.Threading.Monitor.Exit(obj);
}
```