From 27de13f90faa529cebaada7e73ee58c31a220f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Mon, 25 Oct 2010 20:32:17 +0100 Subject: [PATCH] Fixed Forum-32990: Check that interface ISymUnmanagedDispose is supported before using it. --- src/AddIns/Debugger/Debugger.Core/Module.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/AddIns/Debugger/Debugger.Core/Module.cs b/src/AddIns/Debugger/Debugger.Core/Module.cs index e4decab7c4..cea0eeac7d 100644 --- a/src/AddIns/Debugger/Debugger.Core/Module.cs +++ b/src/AddIns/Debugger/Debugger.Core/Module.cs @@ -190,7 +190,12 @@ namespace Debugger public void UnloadSymbols() { if (symReader != null) { - ((ISymUnmanagedDispose)symReader).Destroy(); + // The interface is not always supported, I did not manage to reproduce it, but the + // last callbacks in the user's log were UnloadClass and UnloadModule so I guess + // it has something to do with dynamic modules. + if (symReader is ISymUnmanagedDispose) { + ((ISymUnmanagedDispose)symReader).Destroy(); + } symReader = null; } }