Created
June 19, 2015 18:16
-
-
Save bboyle1234/c6afee5f5bede2d986e6 to your computer and use it in GitHub Desktop.
DisposalTest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Newtonsoft.Json; | |
using System; | |
using System.Collections.Generic; | |
using System.Drawing; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
namespace ConsoleApplication1 { | |
class Program { | |
[STAThread] | |
static void Main(string[] args) { | |
Thread t = new Thread(Run); | |
t.Start(); | |
Console.ReadKey(); | |
} | |
static void Run() { | |
try { | |
using (var t = new Tester()) { | |
} | |
} catch (Exception x) { | |
int i = 0; | |
} | |
} | |
} | |
public class Tester : IDisposable { | |
StreamWriter sw; | |
public Tester() { | |
throw new Exception("hello world"); | |
} | |
public void Dispose() { | |
if (null != sw) | |
sw.Dispose(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment