I'm debugging the open source SvnIndex application (which you can get at
Svn Query). My breakpoint is in the Program.cs file in the Main method.
static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; Mutex mutex = null; try { IndexerArgs indexerArgs = new IndexerArgs(args); mutex = new Mutex(false, indexerArgs.IndexPath.ToLowerInvariant().Replace('\\', '_').Replace(':', '_')); try { mutex.WaitOne(); } catch (AbandonedMutexException) { Console.WriteLine("Warning: Mutex was abandoned from another Process"); } Indexer indexer = new Indexer(indexerArgs); indexer.Run(); } catch (IndexerArgsException x) { Console.WriteLine(x.Message); } finally { if (mutex != null) { mutex.ReleaseMutex(); mutex.Close(); } } AppDomain.CurrentDomain.UnhandledException -= OnUnhandledException; #if DEBUG Console.WriteLine("Press any key"); Console.ReadKey(); #endif }
I'm getting to the indexer.Run() statement just fine. I have a breakpoint on theif (mutex != null) line in the finally block. I hit F10 on the indexer.Run() statement and I never hit my breakpoint (or the breakpoint I have set in the catch block). My understanding is that the code in the finally block ALWAYS gets executed, so how is this possible?
-Charlie