├── #assets ├── Commands.VS2010.pdn ├── Commands.VS2012.pdn └── screenshots │ ├── Exceptions.Set.png │ ├── VS2012.Menu.png │ ├── VS2012.Toolbar.NoToolTip.png │ ├── VS2012.Toolbar.png │ └── VS2013.Options.png ├── #testing ├── ExceptionTest.LibraryOnly │ ├── ExceptionTest.Library.csproj │ ├── ExceptionTest.LibraryOnly.sln │ └── Properties │ │ └── AssemblyInfo.cs ├── ExceptionTest.VS2013 │ ├── ExceptionTest.sln │ └── ExceptionTest │ │ ├── ExceptionTest.csproj │ │ ├── Program.cs │ │ └── Properties │ │ └── AssemblyInfo.cs └── ExceptionTest │ ├── ExceptionTest.sln │ └── ExceptionTest │ ├── ExceptionTest.csproj │ ├── Program.cs │ └── Properties │ └── AssemblyInfo.cs ├── .gitignore ├── ExceptionBreaker.OptionsUITester ├── App.config ├── App.xaml ├── App.xaml.cs ├── ExceptionBreaker.OptionsUITester.csproj ├── MainWindow.xaml ├── MainWindow.xaml.cs └── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── ExceptionBreaker.Tests.Unit ├── CollectionSyncExtensionsTests.cs ├── ExceptionBreaker.Tests.Unit.csproj ├── MoqExtensions.cs ├── OptionsPageDataTests.cs ├── PatternCollectionViewModelTests.cs ├── PatternViewModelTests.cs ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── ExceptionBreaker.sln ├── ExceptionBreaker.sln.DotSettings ├── ExceptionBreaker ├── ComImports │ ├── BREAKPOINT_EDIT_OPERATION.cs │ ├── BREAKPOINT_FILTER_TYPE.cs │ ├── DEBUGGER_OPTIONS.cs │ ├── DEBUGGER_STRING_OPTIONS.cs │ ├── DataTipIdentity.cs │ ├── EBreakpointType.cs │ ├── IBreakpoint.cs │ ├── IBreakpointEvents.cs │ ├── IBreakpointManager.cs │ ├── IDataTipEvents.cs │ ├── IDataTipManager.cs │ ├── IDebuggerInternal10.cs │ ├── IDebuggerInternal11.cs │ ├── IDebuggerInternalEvents.cs │ ├── IMAGEINFO_TYPE.cs │ └── ReadMe.txt ├── CommandIDs.cs ├── ExceptionBreaker.2010.vsct ├── ExceptionBreaker.2012.vsct ├── ExceptionBreaker.csproj ├── ExceptionBreaker.vsct ├── ExceptionBreakerPackage.cs ├── GlobalSuppressions.cs ├── Guids.cs ├── Implementation │ ├── CommandController.cs │ ├── DebugSessionEventSink.cs │ ├── DebugSessionManager.cs │ ├── ExceptionBreakManager.cs │ ├── ExceptionBreakState.cs │ ├── ExtensionLogger.cs │ ├── IDiagnosticLogger.cs │ ├── IExceptionListProvider.cs │ ├── VSInteropHelper.cs │ └── VersionSpecific │ │ ├── DebuggerInternal10Adapter.cs │ │ ├── DebuggerInternal11Adapter.cs │ │ ├── IDebuggerInternalAdapter.cs │ │ └── VersionSpecificAdapterFactory.cs ├── Options │ ├── ExceptionViewModel.cs │ ├── FailSafeJsonTypeConverter.cs │ ├── ImprovedComponentModel │ │ ├── CustomPropertyDescriptor.cs │ │ ├── ImprovedTypeDescriptor.cs │ │ ├── ImprovedTypeDescriptorProvider.cs │ │ └── PropertyDescriptorAttribute.cs │ ├── OptionsPageData.cs │ ├── OptionsPageView.xaml │ ├── OptionsPageView.xaml.cs │ ├── OptionsViewModel.cs │ ├── PatternCollectionViewModel.cs │ ├── PatternData.cs │ ├── PatternViewModel.cs │ ├── ProvideOptionPageInExistingCategoryAttribute.cs │ ├── RegexValidationRule.cs │ └── Support │ │ ├── BindingDelay.cs │ │ ├── BindingDelayExtension.cs │ │ ├── CollectionSyncExtensions.cs │ │ ├── IObservableResult.cs │ │ ├── ObservableCollectionExtensions.cs │ │ ├── ObservableValue.cs │ │ ├── ProperListPropertyDescriptor.cs │ │ └── WpfDialogPageIntegration.cs ├── Properties │ └── AssemblyInfo.cs ├── Resources │ ├── Add.png │ ├── Commands.VS2010.png │ ├── Commands.VS2012.png │ ├── Delete.png │ └── Package.ico ├── Screenshot.png ├── VSPackage.resx ├── packages.config └── source.extension.vsixmanifest ├── nuget.config └── readme.md /#assets/Commands.VS2010.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashmind/ExceptionBreaker/c40a5ae6a83f671314306baeb68ad80653ab42c5/#assets/Commands.VS2010.pdn -------------------------------------------------------------------------------- /#assets/Commands.VS2012.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashmind/ExceptionBreaker/c40a5ae6a83f671314306baeb68ad80653ab42c5/#assets/Commands.VS2012.pdn -------------------------------------------------------------------------------- /#assets/screenshots/Exceptions.Set.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashmind/ExceptionBreaker/c40a5ae6a83f671314306baeb68ad80653ab42c5/#assets/screenshots/Exceptions.Set.png -------------------------------------------------------------------------------- /#assets/screenshots/VS2012.Menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashmind/ExceptionBreaker/c40a5ae6a83f671314306baeb68ad80653ab42c5/#assets/screenshots/VS2012.Menu.png -------------------------------------------------------------------------------- /#assets/screenshots/VS2012.Toolbar.NoToolTip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashmind/ExceptionBreaker/c40a5ae6a83f671314306baeb68ad80653ab42c5/#assets/screenshots/VS2012.Toolbar.NoToolTip.png -------------------------------------------------------------------------------- /#assets/screenshots/VS2012.Toolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashmind/ExceptionBreaker/c40a5ae6a83f671314306baeb68ad80653ab42c5/#assets/screenshots/VS2012.Toolbar.png -------------------------------------------------------------------------------- /#assets/screenshots/VS2013.Options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashmind/ExceptionBreaker/c40a5ae6a83f671314306baeb68ad80653ab42c5/#assets/screenshots/VS2013.Options.png -------------------------------------------------------------------------------- /#testing/ExceptionTest.LibraryOnly/ExceptionTest.Library.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {14602900-B8C2-4BFE-BB5D-CCD173213092} 9 | Library 10 | Properties 11 | ExceptionTest.LibraryOnly 12 | ExceptionTest.LibraryOnly 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 53 | -------------------------------------------------------------------------------- /#testing/ExceptionTest.LibraryOnly/ExceptionTest.LibraryOnly.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExceptionTest.Library", "ExceptionTest.Library.csproj", "{14602900-B8C2-4BFE-BB5D-CCD173213092}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {14602900-B8C2-4BFE-BB5D-CCD173213092}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {14602900-B8C2-4BFE-BB5D-CCD173213092}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {14602900-B8C2-4BFE-BB5D-CCD173213092}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {14602900-B8C2-4BFE-BB5D-CCD173213092}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /#testing/ExceptionTest.LibraryOnly/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ExceptionTest.LibraryOnly")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ExceptionTest.LibraryOnly")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("49d21bf0-d308-4963-8bb5-bd5e6a371d3d")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /#testing/ExceptionTest.VS2013/ExceptionTest.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExceptionTest", "ExceptionTest\ExceptionTest.csproj", "{D0ECF270-581D-49A7-A0EB-27A38DAD5C35}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Debug|Mixed Platforms = Debug|Mixed Platforms 10 | Debug|x86 = Debug|x86 11 | Release|Any CPU = Release|Any CPU 12 | Release|Mixed Platforms = Release|Mixed Platforms 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Debug|Any CPU.ActiveCfg = Debug|x86 17 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 18 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Debug|Mixed Platforms.Build.0 = Debug|x86 19 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Debug|x86.ActiveCfg = Debug|x86 20 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Debug|x86.Build.0 = Debug|x86 21 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Release|Any CPU.ActiveCfg = Release|x86 22 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Release|Mixed Platforms.ActiveCfg = Release|x86 23 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Release|Mixed Platforms.Build.0 = Release|x86 24 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Release|x86.ActiveCfg = Release|x86 25 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Release|x86.Build.0 = Release|x86 26 | EndGlobalSection 27 | GlobalSection(SolutionProperties) = preSolution 28 | HideSolutionNode = FALSE 29 | EndGlobalSection 30 | EndGlobal 31 | -------------------------------------------------------------------------------- /#testing/ExceptionTest.VS2013/ExceptionTest/ExceptionTest.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | x86 6 | 8.0.30703 7 | 2.0 8 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35} 9 | Exe 10 | Properties 11 | ExceptionTest 12 | ExceptionTest 13 | v4.0 14 | Client 15 | 512 16 | 17 | 18 | x86 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | x86 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 57 | -------------------------------------------------------------------------------- /#testing/ExceptionTest.VS2013/ExceptionTest/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace ExceptionTest 6 | { 7 | public static class Program 8 | { 9 | public static void Main(string[] args) { 10 | if (args.Length == 0 || args[0] != "noloop") 11 | StandaloneExceptionLoop(); 12 | 13 | FirstChanceException(); 14 | 15 | // second chance 16 | //throw new ArgumentException(); 17 | } 18 | 19 | private static void StandaloneExceptionLoop() { 20 | Console.WriteLine("Press any key to get an exception."); 21 | while (true) { 22 | Console.ReadKey(); 23 | FirstChanceException(); 24 | Console.WriteLine(" Exception thrown."); 25 | } 26 | } 27 | 28 | private static void FirstChanceException() 29 | { 30 | // first chance 31 | try 32 | { 33 | throw new ArgumentException(); 34 | } 35 | catch (Exception) 36 | { 37 | // do nothing 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /#testing/ExceptionTest.VS2013/ExceptionTest/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Ashmind.VsixTest.Console")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Ashmind.VsixTest.Console")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("0eb3641a-41f6-4685-9520-95b09a112be4")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /#testing/ExceptionTest/ExceptionTest.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExceptionTest", "ExceptionTest\ExceptionTest.csproj", "{D0ECF270-581D-49A7-A0EB-27A38DAD5C35}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Debug|Mixed Platforms = Debug|Mixed Platforms 10 | Debug|x86 = Debug|x86 11 | Release|Any CPU = Release|Any CPU 12 | Release|Mixed Platforms = Release|Mixed Platforms 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Debug|Any CPU.ActiveCfg = Debug|x86 17 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 18 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Debug|Mixed Platforms.Build.0 = Debug|x86 19 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Debug|x86.ActiveCfg = Debug|x86 20 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Debug|x86.Build.0 = Debug|x86 21 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Release|Any CPU.ActiveCfg = Release|x86 22 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Release|Mixed Platforms.ActiveCfg = Release|x86 23 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Release|Mixed Platforms.Build.0 = Release|x86 24 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Release|x86.ActiveCfg = Release|x86 25 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35}.Release|x86.Build.0 = Release|x86 26 | EndGlobalSection 27 | GlobalSection(SolutionProperties) = preSolution 28 | HideSolutionNode = FALSE 29 | EndGlobalSection 30 | EndGlobal 31 | -------------------------------------------------------------------------------- /#testing/ExceptionTest/ExceptionTest/ExceptionTest.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | x86 6 | 8.0.30703 7 | 2.0 8 | {D0ECF270-581D-49A7-A0EB-27A38DAD5C35} 9 | Exe 10 | Properties 11 | ExceptionTest 12 | ExceptionTest 13 | v4.0 14 | Client 15 | 512 16 | 17 | 18 | x86 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | x86 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 57 | -------------------------------------------------------------------------------- /#testing/ExceptionTest/ExceptionTest/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace ExceptionTest 6 | { 7 | public static class Program 8 | { 9 | public static void Main(string[] args) { 10 | if (args.Length == 0 || args[0] != "noloop") 11 | StandaloneExceptionLoop(); 12 | 13 | FirstChanceException(); 14 | 15 | // second chance 16 | //throw new ArgumentException(); 17 | } 18 | 19 | private static void StandaloneExceptionLoop() { 20 | Console.WriteLine("Press any key to get an exception."); 21 | while (true) { 22 | Console.ReadKey(); 23 | FirstChanceException(); 24 | Console.WriteLine(" Exception thrown."); 25 | } 26 | } 27 | 28 | private static void FirstChanceException() 29 | { 30 | // first chance 31 | try 32 | { 33 | throw new ArgumentException(); 34 | } 35 | catch (Exception) 36 | { 37 | // do nothing 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /#testing/ExceptionTest/ExceptionTest/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Ashmind.VsixTest.Console")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Ashmind.VsixTest.Console")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("0eb3641a-41f6-4685-9520-95b09a112be4")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | bin/ 3 | obj/ 4 | \#packages/ 5 | *.suo 6 | *.psess 7 | *.vsp 8 | _ReSharper.* 9 | *.user 10 | *.snk 11 | *.ncrunchsolution 12 | -------------------------------------------------------------------------------- /ExceptionBreaker.OptionsUITester/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ExceptionBreaker.OptionsUITester/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ExceptionBreaker.OptionsUITester/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace ExceptionBreaker.OptionsUITester { 10 | /// 11 | /// Interaction logic for App.xaml 12 | /// 13 | public partial class App : Application { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ExceptionBreaker.OptionsUITester/ExceptionBreaker.OptionsUITester.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {19730CFC-F239-449B-8B6B-CA92BD57C8B3} 8 | WinExe 9 | Properties 10 | ExceptionBreaker.OptionsUITester 11 | ExceptionBreaker.OptionsUITester 12 | v4.5 13 | 512 14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 4 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 4.0 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | MSBuild:Compile 56 | Designer 57 | 58 | 59 | MSBuild:Compile 60 | Designer 61 | 62 | 63 | App.xaml 64 | Code 65 | 66 | 67 | MainWindow.xaml 68 | Code 69 | 70 | 71 | 72 | 73 | Code 74 | 75 | 76 | True 77 | True 78 | Resources.resx 79 | 80 | 81 | True 82 | Settings.settings 83 | True 84 | 85 | 86 | ResXFileCodeGenerator 87 | Resources.Designer.cs 88 | 89 | 90 | SettingsSingleFileGenerator 91 | Settings.Designer.cs 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | {17A398C8-EF46-413B-A564-A70104EFBB64} 101 | ExceptionBreaker 102 | 103 | 104 | 105 | 112 | -------------------------------------------------------------------------------- /ExceptionBreaker.OptionsUITester/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | -------------------------------------------------------------------------------- /ExceptionBreaker.OptionsUITester/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows; 4 | using ExceptionBreaker.Options; 5 | using ExceptionBreaker.Options.Support; 6 | 7 | namespace ExceptionBreaker.OptionsUITester { 8 | /// 9 | /// Interaction logic for MainWindow.xaml 10 | /// 11 | public partial class MainWindow : Window { 12 | public MainWindow() { 13 | InitializeComponent(); 14 | view.Model = new OptionsViewModel( 15 | new OptionsPageData(), 16 | new ObservableValue>(new string[] { 17 | "System.Exception", 18 | "System.ArgumentException", 19 | "System.NullReferenceException", 20 | "System.IO.IOException" 21 | }) 22 | ); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ExceptionBreaker.OptionsUITester/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("ExceptionBreaker.OptionsUITester")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("ExceptionBreaker.OptionsUITester")] 15 | [assembly: AssemblyCopyright("Copyright © 2014")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | -------------------------------------------------------------------------------- /ExceptionBreaker.OptionsUITester/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34014 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ExceptionBreaker.OptionsUITester.Properties { 12 | 13 | 14 | /// 15 | /// A strongly-typed resource class, for looking up localized strings, etc. 16 | /// 17 | // This class was auto-generated by the StronglyTypedResourceBuilder 18 | // class via a tool like ResGen or Visual Studio. 19 | // To add or remove a member, edit your .ResX file then rerun ResGen 20 | // with the /str option, or rebuild your VS project. 21 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 22 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 23 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 24 | internal class Resources { 25 | 26 | private static global::System.Resources.ResourceManager resourceMan; 27 | 28 | private static global::System.Globalization.CultureInfo resourceCulture; 29 | 30 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 31 | internal Resources() { 32 | } 33 | 34 | /// 35 | /// Returns the cached ResourceManager instance used by this class. 36 | /// 37 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 38 | internal static global::System.Resources.ResourceManager ResourceManager { 39 | get { 40 | if ((resourceMan == null)) { 41 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ExceptionBreaker.OptionsUITester.Properties.Resources", typeof(Resources).Assembly); 42 | resourceMan = temp; 43 | } 44 | return resourceMan; 45 | } 46 | } 47 | 48 | /// 49 | /// Overrides the current thread's CurrentUICulture property for all 50 | /// resource lookups using this strongly typed resource class. 51 | /// 52 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 53 | internal static global::System.Globalization.CultureInfo Culture { 54 | get { 55 | return resourceCulture; 56 | } 57 | set { 58 | resourceCulture = value; 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /ExceptionBreaker.OptionsUITester/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /ExceptionBreaker.OptionsUITester/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34014 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ExceptionBreaker.OptionsUITester.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ExceptionBreaker.OptionsUITester/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ExceptionBreaker.Tests.Unit/CollectionSyncExtensionsTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using ExceptionBreaker.Options.Support; 5 | using Xunit; 6 | using Xunit.Extensions; 7 | 8 | namespace ExceptionBreaker.Tests.Unit { 9 | public class CollectionSyncExtensionsTests { 10 | [Theory] 11 | [InlineData("1*,2,3*", "", "1*,3*")] 12 | [InlineData("1,2*,3", "", "2*")] 13 | [InlineData("1,2,3", "", "")] 14 | [InlineData("1,2*,3*,4", "2*,3*,4", "2*,3*")] 15 | [InlineData("1*,2,3", "2,3", "1*")] 16 | [InlineData("1*,2,3", "", "1*")] 17 | [InlineData("1,2,3", "1,2,3", "")] 18 | public void SyncToWhere_ProducesCorrectCollection(string source, string target, string expected) { 19 | var targetList = SplitToList(target); 20 | SplitToList(source).SyncToWhere(targetList, s => s.EndsWith("*")); 21 | 22 | Assert.Equal(SplitToList(expected), targetList); 23 | } 24 | 25 | private static IList SplitToList(string target) { 26 | return target.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ExceptionBreaker.Tests.Unit/ExceptionBreaker.Tests.Unit.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | {0B0C9822-3256-43F4-9F17-9542E0ACFE63} 7 | Library 8 | Properties 9 | ExceptionBreaker.Tests.Unit 10 | ExceptionBreaker.Tests.Unit 11 | v4.5 12 | 512 13 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 10.0 15 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 16 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 17 | False 18 | UnitTest 19 | 20 | 21 | true 22 | full 23 | false 24 | bin\Debug\ 25 | DEBUG;TRACE 26 | prompt 27 | 4 28 | 29 | 30 | pdbonly 31 | true 32 | bin\Release\ 33 | TRACE 34 | prompt 35 | 4 36 | 37 | 38 | 39 | ..\#packages\Argument.1.0.3\lib\net45\Argument.dll 40 | 41 | 42 | False 43 | ..\#packages\AshMind.Extensions.1.6.0\lib\net45\AshMind.Extensions.dll 44 | 45 | 46 | 47 | 48 | False 49 | ..\#packages\Moq.4.2.1409.1722\lib\net40\Moq.dll 50 | 51 | 52 | 53 | 54 | False 55 | ..\#packages\xunit.1.9.2\lib\net20\xunit.dll 56 | 57 | 58 | False 59 | ..\#packages\xunit.extensions.1.9.2\lib\net20\xunit.extensions.dll 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | {17A398C8-EF46-413B-A564-A70104EFBB64} 81 | ExceptionBreaker 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | False 92 | 93 | 94 | False 95 | 96 | 97 | False 98 | 99 | 100 | False 101 | 102 | 103 | 104 | 105 | 106 | 107 | 114 | -------------------------------------------------------------------------------- /ExceptionBreaker.Tests.Unit/MoqExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | using Moq.Language; 5 | using Moq.Language.Flow; 6 | 7 | namespace ExceptionBreaker.Tests.Unit { 8 | public static class MoqExtensions { 9 | public delegate void ActionOut2(T1 arg1, out T2 arg2); 10 | 11 | public static IReturnsThrows Callback(this ICallback mock, ActionOut2 action) 12 | where TMock : class 13 | { 14 | return mock.Callback((Delegate)action); 15 | } 16 | 17 | public static IReturnsThrows Callback(this ICallback mock, Delegate @delegate) 18 | where TMock : class { 19 | mock.GetType() 20 | .Assembly.GetType("Moq.MethodCall") 21 | .InvokeMember("SetCallbackWithArguments", 22 | BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Instance, 23 | null, mock, new object[] { @delegate } 24 | ); 25 | return (IReturnsThrows)mock; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ExceptionBreaker.Tests.Unit/OptionsPageDataTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text.RegularExpressions; 5 | using AshMind.Extensions; 6 | using ExceptionBreaker.Options; 7 | using Microsoft.VisualStudio.Shell.Interop; 8 | using Moq; 9 | using Xunit; 10 | 11 | namespace ExceptionBreaker.Tests.Unit { 12 | public class OptionsPageDataTests { 13 | [Fact] 14 | public void XmlSettings_CanBeReloaded() { 15 | var data = new OptionsPageData { 16 | Ignored = { new PatternData(new Regex("test")) } 17 | }; 18 | 19 | var settings = new Dictionary(); 20 | var writer = MockDictionarySettingsWriter(settings); 21 | data.SaveSettingsToXml(writer.Object); 22 | 23 | var reloaded = new OptionsPageData(); 24 | var reader = MockDictionarySettingsReader(settings); 25 | reloaded.LoadSettingsFromXml(reader.Object); 26 | 27 | Assert.Equal( 28 | data.Ignored.Select(p => new { Regex = p.Regex.ToString(), p.Enabled }), 29 | reloaded.Ignored.Select(p => new { Regex = p.Regex.ToString(), p.Enabled }) 30 | ); 31 | } 32 | 33 | private static Mock MockDictionarySettingsWriter(IDictionary settings) { 34 | var writer = new Mock(); 35 | writer.Setup(x => x.WriteSettingString(It.IsAny(), It.IsAny())) 36 | .Callback((string key, string value) => settings.Add(key, value)); 37 | return writer; 38 | } 39 | 40 | private Mock MockDictionarySettingsReader(IDictionary settings) { 41 | var reader = new Mock(); 42 | string _; 43 | reader.Setup(x => x.ReadSettingString(It.IsAny(), out _)) 44 | .Callback((string key, out string value) => { value = settings.GetValueOrDefault(key); }); 45 | return reader; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /ExceptionBreaker.Tests.Unit/PatternCollectionViewModelTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Linq; 5 | using ExceptionBreaker.Options; 6 | using Xunit; 7 | 8 | namespace ExceptionBreaker.Tests.Unit { 9 | public class PatternCollectionViewModelTests { 10 | [Fact] 11 | public void Add_AddsItemToData_IfPatternIsSet() { 12 | var data = new Collection(); 13 | var model = new PatternCollectionViewModel(data); 14 | model.Values.Add(new PatternViewModel("x")); 15 | 16 | Assert.Equal(new[] { "x" }, data.Select(p => p.Regex.ToString())); 17 | } 18 | 19 | [Fact] 20 | public void Add_DoesNotAddItemToData_IfPatternIsNotSet() { 21 | var data = new Collection(); 22 | var model = new PatternCollectionViewModel(data); 23 | model.Values.Add(new PatternViewModel("")); 24 | 25 | Assert.Empty(data); 26 | } 27 | 28 | [Fact] 29 | public void PatternChange_AddsItemToData_IfPatternIsSet() { 30 | var data = new Collection(); 31 | var model = new PatternCollectionViewModel(data); 32 | var pattern = new PatternViewModel(""); 33 | model.Values.Add(pattern); 34 | 35 | pattern.Pattern.Value = "x"; 36 | Assert.Equal(new[] { "x" }, data.Select(p => p.Regex.ToString())); 37 | } 38 | 39 | [Fact] 40 | public void PatternChange_RemovesItemToData_IfPatternIsNotSet() { 41 | var data = new Collection(); 42 | var model = new PatternCollectionViewModel(data); 43 | var pattern = new PatternViewModel("x"); 44 | model.Values.Add(pattern); 45 | 46 | pattern.Pattern.Value = ""; 47 | Assert.Empty(data); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /ExceptionBreaker.Tests.Unit/PatternViewModelTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text.RegularExpressions; 5 | using ExceptionBreaker.Options; 6 | using Xunit; 7 | 8 | namespace ExceptionBreaker.Tests.Unit { 9 | public class PatternViewModelTests { 10 | [Fact] 11 | public void Pattern_IsSetFromDataRegex() { 12 | var model = new PatternViewModel(new PatternData(new Regex("x"))); 13 | Assert.Equal("x", model.Pattern.Value); 14 | } 15 | 16 | [Fact] 17 | public void DataRegex_IsUpdatedWhenPatternIsSet() { 18 | var model = new PatternViewModel(""); 19 | model.Pattern.Value = "x"; 20 | Assert.Equal("x", model.Data.Regex.ToString()); 21 | } 22 | 23 | [Fact] 24 | public void Enabled_IsSetFromDataEnabled() { 25 | var model = new PatternViewModel(new PatternData(new Regex("")) { Enabled = false }); 26 | Assert.False(model.Enabled.Value); 27 | } 28 | 29 | [Fact] 30 | public void DataEnabled_IsUpdatedWhenEnabledIsSet() { 31 | var model = new PatternViewModel(""); 32 | model.Enabled.Value = !model.Enabled.Value; 33 | Assert.Equal(model.Enabled.Value, model.Data.Enabled); 34 | } 35 | 36 | [Fact] 37 | public void IsEmpty_IsTrue_IfPatternIsSetToEmpty() { 38 | var model = new PatternViewModel("x"); 39 | model.Pattern.Value = ""; 40 | 41 | Assert.True(model.IsEmpty.Value); 42 | } 43 | 44 | [Fact] 45 | public void IsEmpty_IsFalse_IfPatternIsSetToNonEmpty() { 46 | var model = new PatternViewModel(""); 47 | model.Pattern.Value = "x"; 48 | 49 | Assert.False(model.IsEmpty.Value); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /ExceptionBreaker.Tests.Unit/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ExceptionBreaker.Tests.Unit")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ExceptionBreaker.Tests.Unit")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("5c329d0d-68a7-48ba-80e8-48487ef837b9")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ExceptionBreaker.Tests.Unit/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ExceptionBreaker.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExceptionBreaker", "ExceptionBreaker\ExceptionBreaker.csproj", "{17A398C8-EF46-413B-A564-A70104EFBB64}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExceptionBreaker.OptionsUITester", "ExceptionBreaker.OptionsUITester\ExceptionBreaker.OptionsUITester.csproj", "{19730CFC-F239-449B-8B6B-CA92BD57C8B3}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExceptionBreaker.Tests.Unit", "ExceptionBreaker.Tests.Unit\ExceptionBreaker.Tests.Unit.csproj", "{0B0C9822-3256-43F4-9F17-9542E0ACFE63}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Debug-VS2013|Any CPU = Debug-VS2013|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {17A398C8-EF46-413B-A564-A70104EFBB64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {17A398C8-EF46-413B-A564-A70104EFBB64}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {17A398C8-EF46-413B-A564-A70104EFBB64}.Debug-VS2013|Any CPU.ActiveCfg = Debug-VS2013|Any CPU 22 | {17A398C8-EF46-413B-A564-A70104EFBB64}.Debug-VS2013|Any CPU.Build.0 = Debug-VS2013|Any CPU 23 | {17A398C8-EF46-413B-A564-A70104EFBB64}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {17A398C8-EF46-413B-A564-A70104EFBB64}.Release|Any CPU.Build.0 = Release|Any CPU 25 | {19730CFC-F239-449B-8B6B-CA92BD57C8B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 26 | {19730CFC-F239-449B-8B6B-CA92BD57C8B3}.Debug|Any CPU.Build.0 = Debug|Any CPU 27 | {19730CFC-F239-449B-8B6B-CA92BD57C8B3}.Debug-VS2013|Any CPU.ActiveCfg = Debug|Any CPU 28 | {19730CFC-F239-449B-8B6B-CA92BD57C8B3}.Debug-VS2013|Any CPU.Build.0 = Debug|Any CPU 29 | {19730CFC-F239-449B-8B6B-CA92BD57C8B3}.Release|Any CPU.ActiveCfg = Release|Any CPU 30 | {19730CFC-F239-449B-8B6B-CA92BD57C8B3}.Release|Any CPU.Build.0 = Release|Any CPU 31 | {0B0C9822-3256-43F4-9F17-9542E0ACFE63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 32 | {0B0C9822-3256-43F4-9F17-9542E0ACFE63}.Debug|Any CPU.Build.0 = Debug|Any CPU 33 | {0B0C9822-3256-43F4-9F17-9542E0ACFE63}.Debug-VS2013|Any CPU.ActiveCfg = Debug|Any CPU 34 | {0B0C9822-3256-43F4-9F17-9542E0ACFE63}.Debug-VS2013|Any CPU.Build.0 = Debug|Any CPU 35 | {0B0C9822-3256-43F4-9F17-9542E0ACFE63}.Release|Any CPU.ActiveCfg = Release|Any CPU 36 | {0B0C9822-3256-43F4-9F17-9542E0ACFE63}.Release|Any CPU.Build.0 = Release|Any CPU 37 | EndGlobalSection 38 | GlobalSection(SolutionProperties) = preSolution 39 | HideSolutionNode = FALSE 40 | EndGlobalSection 41 | EndGlobal 42 | -------------------------------------------------------------------------------- /ExceptionBreaker.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | END_OF_LINE 3 | END_OF_LINE 4 | END_OF_LINE 5 | END_OF_LINE 6 | END_OF_LINE 7 | END_OF_LINE 8 | False 9 | System 10 | System.Collections.Generic 11 | System.Linq 12 | VS 13 | <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> 14 | True 15 | True -------------------------------------------------------------------------------- /ExceptionBreaker/ComImports/BREAKPOINT_EDIT_OPERATION.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable CheckNamespace 2 | namespace Microsoft.VisualStudio.Debugger.Interop.Internal { 3 | // ReSharper restore CheckNamespace 4 | public enum BREAKPOINT_EDIT_OPERATION { 5 | Edit_Location, 6 | Edit_Condition, 7 | Edit_HitCount, 8 | Edit_Constraint, 9 | Edit_Action, 10 | Edit_Labels, 11 | Edit_Export 12 | } 13 | } -------------------------------------------------------------------------------- /ExceptionBreaker/ComImports/BREAKPOINT_FILTER_TYPE.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable CheckNamespace 2 | namespace Microsoft.VisualStudio.Debugger.Interop.Internal { 3 | // ReSharper restore CheckNamespace 4 | public enum BREAKPOINT_FILTER_TYPE { 5 | NONE, 6 | IS_ENABLED, 7 | IS_CONDITION, 8 | IS_HIT_COUNT, 9 | IS_CONSTRAINTS, 10 | IS_ACTION 11 | } 12 | } -------------------------------------------------------------------------------- /ExceptionBreaker/ComImports/DEBUGGER_OPTIONS.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable CheckNamespace 2 | namespace Microsoft.VisualStudio.Debugger.Interop.Internal { 3 | // ReSharper restore CheckNamespace 4 | public enum DEBUGGER_OPTIONS { 5 | Option_ConfirmDeleteAllBreakpoints, 6 | Option_StopAllProcesses, 7 | Option_StopOnExceptionCrossingManagedBoundary, 8 | Option_EnableAddressLevelDebugging, 9 | Option_ShowDisassemblyWhenNoSource, 10 | Option_EnableBreakpointConstraints, 11 | Option_UseExceptionHelper, 12 | Option_AutoUnwindOnException, 13 | Option_JustMyCode, 14 | Option_ShowNonPublicMembers, 15 | Option_WarnIfNoUserCodeOnLaunch, 16 | Option_FrameworkSourceStepping, 17 | Option_WarnAboutSymbolCacheDuringRemoteManagedDebugging, 18 | Option_EnableStepFiltering, 19 | Option_WarnOnStepFilter, 20 | Option_AllowImplicitFuncEval, 21 | Option_AllowToString, 22 | Option_UseSourceServer, 23 | Option_ShowSourceServerDiagnostics, 24 | Option_AlwaysColorMarkerText, 25 | Option_UseDocumentChecksum, 26 | Option_OutputToImmediate, 27 | Option_ShowRawStructures, 28 | Option_DisableJITOptimization, 29 | Option_ShowNoSymbolsDialog, 30 | Option_ShowScriptDebuggingDisabledDialog, 31 | Option_EnableILInterpreterMinidump, 32 | Option_EnableILInterpreterLive, 33 | Option_HexDisplay, 34 | Option_HexInput, 35 | Option_MapClientBreakpoints, 36 | Option_AddUnmappedBreakpointAtMappedLocation, 37 | Option_StepIntoOnRestart, 38 | Option_ENCEnable, 39 | Option_ENCApplyChangesOnContinue, 40 | Option_ENCWelcome, 41 | Option_ENCStaleCodeWarning, 42 | Option_ENCPrecompile, 43 | Option_ENCRelink, 44 | Option_NOENCAllowEdits, 45 | Option_NOENCIgnore, 46 | Option_NOENCRebuild, 47 | Option_ENCEnableWhenRemoteDebugging, 48 | Option_ConfirmFoundFiles, 49 | Option_DisasmLineNumbers, 50 | Option_ModulesShowAll, 51 | Option_UseCodeSense, 52 | Option_DisasmFields, 53 | Option_CallStackViewOptions, 54 | Option_ShowExternalCode, 55 | Option_SourceStepUnit, 56 | Option_DisasmStepUnit, 57 | Option_CrossThreadCallStack, 58 | Option_ShowOnlyFlaggedThreads, 59 | Option_ConcurrencySupport, 60 | Option_GuessAtThreadNames, 61 | Option_ShowOtherThreadIpMarkers, 62 | Option_ShowThreadCategory, 63 | Option_SaveRemoteDumps, 64 | Option_LongEvalTimeout, 65 | Option_NormalEvalTimeout, 66 | Option_QuickwatchTimeout, 67 | Option_DataTipTimeout, 68 | Option_AutosReturnValsTimeout, 69 | Option_AutosRegistersTimeout, 70 | Option_LocalsTimeout, 71 | Option_RegistersTimeout, 72 | Option_AddressExpressionTimeout, 73 | Option_ScriptDocsTimeout, 74 | Option_ImmediateWindowTimeout, 75 | Option_SetValueTimeout, 76 | Option_TreeGridRePaintTimer, 77 | Option_TreeGridBusyPaintTimer, 78 | Option_ModulesWindowUpdateTimer, 79 | Option_TreeGridDelayOnEnterTimer, 80 | Option_DelayTreeGridPaintOnBreak, 81 | Option_ShowNonprintableCharsAsGlyphs, 82 | Option_ShowSystemProcesses, 83 | Option_ShowProcessesFromAllSessions, 84 | Option_EnhancedDataTips, 85 | Option_DataTipDismissalSensitivity, 86 | Option_DataTipKeyboardDismissal, 87 | Option_UserSpecifiedEngines, 88 | Option_OutputOnException, 89 | Option_OutputOnStepFilter, 90 | Option_OutputOnModuleLoad, 91 | Option_OutputOnModuleUnload, 92 | Option_OutputOnModuleSymbolSearch, 93 | Option_OutputOnProcessDestroy, 94 | Option_OutputOnThreadDestroy, 95 | Option_OutputOnOutputDebugString, 96 | Option_OutputOnDebuggerMessage, 97 | Option_VariableWindowIcons, 98 | Option_DisableAttachSecurityWarning, 99 | Option_LoadDllExports, 100 | Option_NativeRPC, 101 | Option_AllowSideEffectEval, 102 | Option_LoadSymbolsWhenSettingsChanged, 103 | Option_SymbolUseExcludeList, 104 | Option_SymbolsAlwaysLoadAdjacent, 105 | Option_DontForceCacheOnManualLoad, 106 | Option_SymbolUseMSSymbolServers, 107 | Option_AutoLoadFromSymbolPath, 108 | Option_OneClickEdit, 109 | Option_OfferArrayExpansion, 110 | Option_VariableWindowPromptOnLargeExpansion, 111 | Option_VariableWindowMaxSupportedChildren, 112 | Option_PromptToAddSourceToIgnoreList, 113 | Option_OwnerDrawDebugLocationToolbar, 114 | Option_EnableSelectedBreakpointHighlight, 115 | Option_DisableUniscribe, 116 | Option_ShowParallelStacksBottomUp, 117 | Option_ThreadsWindowGroupingColumn, 118 | Option_ThreadsWindowVisibleColumns, 119 | Option_ThreadsWindowShowTipWhenCallStackExpanded, 120 | Option_AllowDesignModePinning, 121 | Option_CallStackParamToString, 122 | Option_CheckRDTForFilesFirst, 123 | LastOption 124 | } 125 | } -------------------------------------------------------------------------------- /ExceptionBreaker/ComImports/DEBUGGER_STRING_OPTIONS.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable CheckNamespace 2 | namespace Microsoft.VisualStudio.Debugger.Interop.Internal { 3 | // ReSharper restore CheckNamespace 4 | public enum DEBUGGER_STRING_OPTIONS { 5 | StringOption_SourceServerExtractToDirectory, 6 | StringOption_FrameworkSourceServerName, 7 | StringOption_PublicSymbolServerName, 8 | StringOption_PublicSymbolServerName2, 9 | StringOption_DefaultTracepointMessage, 10 | StringOption_ProgramToDebugPath, 11 | StringOption_AttachToProcessDefaultEngineList, 12 | StringOption_SecureSourceLocalDirectory, 13 | StringOption_SymbolPath, 14 | StringOption_SymbolPathState, 15 | StringOption_SymbolCacheDir, 16 | StringOption_SymbolIncludeList, 17 | StringOption_SymbolIncludeListState, 18 | StringOption_SymbolExcludeList, 19 | StringOption_SymbolExcludeListState, 20 | LastStringOption 21 | } 22 | } -------------------------------------------------------------------------------- /ExceptionBreaker/ComImports/DataTipIdentity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | 7 | // ReSharper disable CheckNamespace 8 | namespace Microsoft.VisualStudio.Debugger.Interop.Internal { 9 | // ReSharper restore CheckNamespace 10 | [StructLayout(LayoutKind.Sequential, Pack = 8)] 11 | public struct DataTipIdentity { 12 | [MarshalAs(UnmanagedType.BStr)] 13 | public string moniker; 14 | public uint position; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ExceptionBreaker/ComImports/EBreakpointType.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable CheckNamespace 2 | namespace Microsoft.VisualStudio.Debugger.Interop.Internal { 3 | // ReSharper restore CheckNamespace 4 | public enum EBreakpointType { 5 | NoBreakpointType, 6 | PendingBreakpoint, 7 | BoundBreakpoint, 8 | ErrorBreakpoint, 9 | WarningBreakpoint, 10 | BreakpointGroup, 11 | EBreakpointType_LAST 12 | } 13 | } -------------------------------------------------------------------------------- /ExceptionBreaker/ComImports/IBreakpoint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // ReSharper disable CheckNamespace 6 | namespace Microsoft.VisualStudio.Debugger.Interop.Internal { 7 | // ReSharper restore CheckNamespace 8 | [ComImport, Guid("17AE185F-980F-4262-A3F0-0D3DEB2CF79A"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 9 | public interface IBreakpoint { 10 | [DispId(0x60010000)] 11 | IDebugCodeContext2 CodeContext { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 12 | [DispId(0x60010001), ComAliasName("Microsoft.VisualStudio.Debugger.Interop.Internal.EBreakpointType")] 13 | EBreakpointType Type { [return: ComAliasName("Microsoft.VisualStudio.Debugger.Interop.Internal.EBreakpointType")] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 14 | [DispId(0x60010002)] 15 | IBreakpoint Parent { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 16 | [DispId(0x60010003)] 17 | int IsEnabled { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 18 | [DispId(0x60010004)] 19 | Array Children { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 20 | } 21 | } -------------------------------------------------------------------------------- /ExceptionBreaker/ComImports/IBreakpointEvents.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | using System.Runtime.InteropServices; 3 | 4 | // ReSharper disable CheckNamespace 5 | namespace Microsoft.VisualStudio.Debugger.Interop.Internal { 6 | // ReSharper restore CheckNamespace 7 | [ComImport, Guid("405E9EA6-4CD0-404C-927F-477BF8E09696"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 8 | public interface IBreakpointEvents { 9 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 10 | int Changed(); 11 | } 12 | } -------------------------------------------------------------------------------- /ExceptionBreaker/ComImports/IBreakpointManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // ReSharper disable CheckNamespace 6 | namespace Microsoft.VisualStudio.Debugger.Interop.Internal { 7 | // ReSharper restore CheckNamespace 8 | [ComImport, Guid("9499FBA0-8C9D-49F1-B130-A25DED8A89DE"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 9 | public interface IBreakpointManager { 10 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 11 | int ToggleBreakpointsAtCodeContext([In, MarshalAs(UnmanagedType.Interface)] IDebugCodeContext2 pCodeContext); 12 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 13 | int InsertBreakpointAtCodeContext([In, MarshalAs(UnmanagedType.Interface)] IDebugCodeContext2 pCodeContext); 14 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 15 | int InsertTracepointAtCodeContext([In, MarshalAs(UnmanagedType.Interface)] IDebugCodeContext2 pCodeContext); 16 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 17 | int DeleteBreakpointAtCodeContext([In, MarshalAs(UnmanagedType.Interface)] IDebugCodeContext2 pCodeContext); 18 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 19 | int EnableBreakpointAtCodeContext([In, MarshalAs(UnmanagedType.Interface)] IDebugCodeContext2 pCodeContext, [In] bool enable); 20 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 21 | int DoesCodeContextContainAnyBreakpoints([In, MarshalAs(UnmanagedType.Interface)] IDebugCodeContext2 pCodeContext, [In] BREAKPOINT_FILTER_TYPE filter, out int answer); 22 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 23 | int AdviseEvents([In, MarshalAs(UnmanagedType.Interface)] IBreakpointEvents pHandler); 24 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 25 | int UnadviseEvents([In, MarshalAs(UnmanagedType.Interface)] IBreakpointEvents pHandler); 26 | [DispId(0x60010008)] 27 | Array Breakpoints { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UNKNOWN)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 28 | } 29 | } -------------------------------------------------------------------------------- /ExceptionBreaker/ComImports/IDataTipEvents.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | using System.Runtime.InteropServices; 3 | 4 | // ReSharper disable CheckNamespace 5 | namespace Microsoft.VisualStudio.Debugger.Interop.Internal { 6 | // ReSharper restore CheckNamespace 7 | [ComImport, Guid("C7097399-F1BF-4C37-ABEC-44A787170A46"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 8 | public interface IDataTipEvents { 9 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 10 | int TearOff([In, ComAliasName("Microsoft.VisualStudio.Debugger.Interop.Internal.DataTipIdentity"), MarshalAs(UnmanagedType.LPArray)] DataTipIdentity[] Id, [In, ComAliasName("AD7InteropA.DEBUG_PROPERTY_INFO")] DEBUG_PROPERTY_INFO info, [In] int screenX, [In] int screenY, [In] int width, [In] int height); 11 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 12 | int UndoTearOff([In, ComAliasName("Microsoft.VisualStudio.Debugger.Interop.Internal.DataTipIdentity"), MarshalAs(UnmanagedType.LPArray)] DataTipIdentity[] Id, [In, ComAliasName("AD7InteropA.DEBUG_PROPERTY_INFO")] DEBUG_PROPERTY_INFO info); 13 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 14 | int Closing([In, ComAliasName("Microsoft.VisualStudio.Debugger.Interop.Internal.DataTipIdentity"), MarshalAs(UnmanagedType.LPArray)] DataTipIdentity[] Id, [In, ComAliasName("AD7InteropA.DEBUG_PROPERTY_INFO")] DEBUG_PROPERTY_INFO info); 15 | } 16 | } -------------------------------------------------------------------------------- /ExceptionBreaker/ComImports/IDataTipManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using Microsoft.VisualStudio.OLE.Interop; 5 | 6 | // ReSharper disable CheckNamespace 7 | namespace Microsoft.VisualStudio.Debugger.Interop.Internal { 8 | // ReSharper restore CheckNamespace 9 | [ComImport, Guid("6517701C-2475-4CC7-B23C-148E0900FEF2"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 10 | public interface IDataTipManager { 11 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 12 | int AdviseEvents([In, MarshalAs(UnmanagedType.Interface)] IDataTipEvents pHandler); 13 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 14 | int UnadviseEvents([In, MarshalAs(UnmanagedType.Interface)] IDataTipEvents pHandler); 15 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 16 | int ShowChildDataTip([In, ComAliasName("AD7InteropA.DEBUG_PROPERTY_INFO"), MarshalAs(UnmanagedType.LPArray)] DEBUG_PROPERTY_INFO[] parentExpression, [In] ulong owningHwnd, [In] int x, [In] int y, [In, ComAliasName("Microsoft.VisualStudio.Debugger.Interop.Internal.DataTipIdentity"), MarshalAs(UnmanagedType.LPArray)] DataTipIdentity[] identity); 17 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 18 | int ShowFrameEnumToolTip([In, MarshalAs(UnmanagedType.Interface)] IEnumDebugFrameInfo2 pFrame, [In] ulong hwndOwner, [In, ComAliasName("OLE.POINT"), MarshalAs(UnmanagedType.LPArray)] POINT[] pptTopLeft, [In, ComAliasName("OLE.RECT"), MarshalAs(UnmanagedType.LPArray)] RECT[] pHotRect, [In] int bHoverInvoked); 19 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 20 | int ShowThreadToolTip([In, MarshalAs(UnmanagedType.Interface)] IDebugThread2 pThread, [In] ulong hwndOwner, [In, ComAliasName("OLE.POINT"), MarshalAs(UnmanagedType.LPArray)] POINT[] pptTopLeft, [In, ComAliasName("OLE.RECT"), MarshalAs(UnmanagedType.LPArray)] RECT[] pHotRect, [In] int bHoverInvoked); 21 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 22 | int IsThreadToolTipActive(out bool pActive); 23 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 24 | int GetThreadToolTipFramesCount(out int pCount); 25 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 26 | int GetThreadToolTipFrame([In] int row, [MarshalAs(UnmanagedType.BStr)] out string pFrameText, out bool pIsExpandable); 27 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 28 | int CloseThreadToolTip(); 29 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 30 | int CloseTip([In, ComAliasName("Microsoft.VisualStudio.Debugger.Interop.Internal.DataTipIdentity"), MarshalAs(UnmanagedType.LPArray)] DataTipIdentity[] identity); 31 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 32 | int OpenTip([In, ComAliasName("Microsoft.VisualStudio.Debugger.Interop.Internal.DataTipIdentity"), MarshalAs(UnmanagedType.LPArray)] DataTipIdentity[] identiy, [In, MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_BSTR)] Array expressions); 33 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 34 | int RemoveExpression([In, ComAliasName("Microsoft.VisualStudio.Debugger.Interop.Internal.DataTipIdentity"), MarshalAs(UnmanagedType.LPArray)] DataTipIdentity[] identity, [In, MarshalAs(UnmanagedType.BStr)] string expression); 35 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 36 | int AddExpression([In, ComAliasName("Microsoft.VisualStudio.Debugger.Interop.Internal.DataTipIdentity"), MarshalAs(UnmanagedType.LPArray)] DataTipIdentity[] identity, [In, MarshalAs(UnmanagedType.BStr)] string expression); 37 | } 38 | } -------------------------------------------------------------------------------- /ExceptionBreaker/ComImports/IDebuggerInternal10.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // ReSharper disable CheckNamespace 6 | namespace Microsoft.VisualStudio.Debugger.Interop.Internal { 7 | // ReSharper restore CheckNamespace 8 | [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("1DA40549-8CCC-48CF-B99B-FC22FE3AFEDF")] 9 | public interface IDebuggerInternal10 { 10 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 11 | int GetSourceFileWithChecksum([In, MarshalAs(UnmanagedType.BStr)] string bstrSearchFilePath, [In] ref Guid checksumAlgorithm, [In, MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UI1)] Array Checksum, [MarshalAs(UnmanagedType.BStr)] out string bstrFoundFilePath); 12 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 13 | int GetSourceFileFromDocumentContext([In, MarshalAs(UnmanagedType.Interface)] IDebugDocumentContext2 pDocumentContext, [In, MarshalAs(UnmanagedType.Interface)] IDebugCodeContext2 pCodeContext, [MarshalAs(UnmanagedType.BStr)] out string bstrFoundFilePath, out Guid checksumAlgorithm, [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UI1)] out Array Checksum); 14 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 15 | int GetCodeContextOfExpression([In, MarshalAs(UnmanagedType.BStr)] string expression, [MarshalAs(UnmanagedType.Interface)] out IDebugCodeContext2 ppCodeContext, [MarshalAs(UnmanagedType.BStr)] out string error); 16 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 17 | int GetDebuggerOption([In] DEBUGGER_OPTIONS option, out uint value); 18 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 19 | int GetDebuggerStringOption([In] DEBUGGER_STRING_OPTIONS option, [MarshalAs(UnmanagedType.BStr)] out string value); 20 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 21 | int SetDebuggerOption([In] DEBUGGER_OPTIONS option, [In] uint value); 22 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 23 | int SetDebuggerStringOption([In] DEBUGGER_STRING_OPTIONS option, [In, MarshalAs(UnmanagedType.BStr)] string value); 24 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 25 | int SetNextStatement([In, MarshalAs(UnmanagedType.Interface)] IDebugCodeContext2 pCodeContext); 26 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 27 | int RunToStatement([In, MarshalAs(UnmanagedType.Interface)] IDebugCodeContext2 pCodeContext); 28 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 29 | int GoToSource([In, MarshalAs(UnmanagedType.Interface)] IDebugDocumentContext2 pDocContext, [In, MarshalAs(UnmanagedType.Interface)] IDebugCodeContext2 pCodeContext); 30 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 31 | int GoToDisassembly([In, MarshalAs(UnmanagedType.Interface)] IDebugCodeContext2 pCodeContext, [In, MarshalAs(UnmanagedType.Interface)] IDebugProgram2 pProgramOfCodeContext); 32 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 33 | int EditBreakpoint([In, MarshalAs(UnmanagedType.Interface)] IBreakpoint pBreakpoint, [In] BREAKPOINT_EDIT_OPERATION op); 34 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 35 | int SetEngineMetric([In] ref Guid engine, [In, MarshalAs(UnmanagedType.BStr)] string metric, [In, MarshalAs(UnmanagedType.Struct)] object var); 36 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 37 | int UpdateAddressMarkers(); 38 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 39 | int DeleteAddressMarkers(); 40 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 41 | int ShowVisualizer([In, ComAliasName("AD7InteropA.DEBUG_PROPERTY_INFO"), MarshalAs(UnmanagedType.LPArray)] DEBUG_PROPERTY_INFO[] data, [In] uint visualizerId); 42 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 43 | int UpdateExpressionValue([In, ComAliasName("AD7InteropA.DEBUG_PROPERTY_INFO"), MarshalAs(UnmanagedType.LPArray)] DEBUG_PROPERTY_INFO[] data, [In, MarshalAs(UnmanagedType.BStr)] string newValue, [MarshalAs(UnmanagedType.BStr)] out string error); 44 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 45 | int CreateObjectID([In, ComAliasName("AD7InteropA.DEBUG_PROPERTY_INFO"), MarshalAs(UnmanagedType.LPArray)] DEBUG_PROPERTY_INFO[] data); 46 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 47 | int DestroyObjectID([In, ComAliasName("AD7InteropA.DEBUG_PROPERTY_INFO"), MarshalAs(UnmanagedType.LPArray)] DEBUG_PROPERTY_INFO[] data); 48 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 49 | int IndicateEvalRequiresRefresh([In, ComAliasName("AD7InteropA.DEBUG_PROPERTY_INFO"), MarshalAs(UnmanagedType.LPArray)] DEBUG_PROPERTY_INFO[] src); 50 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 51 | int RegisterInternalEventSink([In, MarshalAs(UnmanagedType.Interface)] IDebuggerInternalEvents pEvents); 52 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 53 | int UnregisterInternalEventSink([In, MarshalAs(UnmanagedType.Interface)] IDebuggerInternalEvents pEvents); 54 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 55 | int IsProcessActivelyBeingDebugged([In, MarshalAs(UnmanagedType.Interface)] IDebugProcess2 pProcess, out bool retVal); 56 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 57 | int OnCaretMoved(); 58 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 59 | int GetSymbolPathInternal([MarshalAs(UnmanagedType.BStr)] out string pbstrSymbolPath, [MarshalAs(UnmanagedType.BStr)] out string pbstrSymbolCachePath); 60 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 61 | int GetImageInfo([In, MarshalAs(UnmanagedType.BStr)] string imageName, [Out, ComAliasName("Microsoft.VisualStudio.Debugger.Interop.Internal.IMAGEINFO_TYPE"), MarshalAs(UnmanagedType.LPArray)] IMAGEINFO_TYPE[] pImageInfoType); 62 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 63 | int IsInteropSupported([In, MarshalAs(UnmanagedType.BStr)] string imageName); 64 | [DispId(0x6001001b)] 65 | IDebugSession3 CurrentSession { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 66 | [DispId(0x6001001c)] 67 | IDebugProgram2 CurrentProgram { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; [param: In, MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] set; } 68 | [DispId(0x6001001e)] 69 | IDebugThread2 CurrentThread { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; [param: In, MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] set; } 70 | [DispId(0x60010020)] 71 | IEnumDebugFrameInfo2 CurrentStack { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 72 | [DispId(0x60010021)] 73 | IDebugStackFrame2 CurrentStackFrame { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; [param: In, MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] set; } 74 | [DispId(0x60010023)] 75 | IDebugCodeContext2 CurrentCodeContext { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 76 | [DispId(0x60010024)] 77 | IDebugStackFrame2 TopMostStackFrame { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 78 | [DispId(0x60010025)] 79 | IDebugCodeContext2 TopMostCodeContext { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 80 | [DispId(0x60010026)] 81 | bool InDisassemblyMode { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] set; } 82 | [DispId(0x60010028)] 83 | bool InApplyCodeChanges { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 84 | [DispId(0x60010029)] 85 | bool InBreakMode { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 86 | [DispId(0x6001002a)] 87 | IBreakpointManager BreakpointManager { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 88 | [DispId(0x6001002b)] 89 | bool ArePendingEditsBlockingSetNext { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 90 | [DispId(0x6001002c)] 91 | IDataTipManager DataTipManager { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 92 | } 93 | } -------------------------------------------------------------------------------- /ExceptionBreaker/ComImports/IDebuggerInternal11.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // ReSharper disable CheckNamespace 6 | namespace Microsoft.VisualStudio.Debugger.Interop.Internal { 7 | // ReSharper restore CheckNamespace 8 | [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("1DA40549-8CCC-48CF-B99B-FC22FE3AFEDF")] 9 | public interface IDebuggerInternal11 { 10 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 11 | int GetSourceFileWithChecksum([In, MarshalAs(UnmanagedType.BStr)] string bstrSearchFilePath, [In] ref Guid checksumAlgorithm, [In, MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UI1)] Array Checksum, [MarshalAs(UnmanagedType.BStr)] out string bstrFoundFilePath); 12 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 13 | int GetSourceFileFromDocumentContext([In, MarshalAs(UnmanagedType.Interface)] IDebugDocumentContext2 pDocumentContext, [In, MarshalAs(UnmanagedType.Interface)] IDebugCodeContext2 pCodeContext, [MarshalAs(UnmanagedType.BStr)] out string bstrFoundFilePath, out Guid checksumAlgorithm, [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UI1)] out Array Checksum); 14 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 15 | int GetCodeContextOfExpression([In, MarshalAs(UnmanagedType.BStr)] string expression, [MarshalAs(UnmanagedType.Interface)] out IDebugCodeContext2 ppCodeContext, [MarshalAs(UnmanagedType.BStr)] out string error); 16 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 17 | int GetDebuggerOption([In] DEBUGGER_OPTIONS option, out uint value); 18 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 19 | int GetDebuggerStringOption([In] DEBUGGER_STRING_OPTIONS option, [MarshalAs(UnmanagedType.BStr)] out string value); 20 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 21 | int SetDebuggerOption([In] DEBUGGER_OPTIONS option, [In] uint value); 22 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 23 | int SetDebuggerStringOption([In] DEBUGGER_STRING_OPTIONS option, [In, MarshalAs(UnmanagedType.BStr)] string value); 24 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 25 | int SetNextStatement([In, MarshalAs(UnmanagedType.Interface)] IDebugCodeContext2 pCodeContext); 26 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 27 | int RunToStatement([In, MarshalAs(UnmanagedType.Interface)] IDebugCodeContext2 pCodeContext); 28 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 29 | int GoToSource([In, MarshalAs(UnmanagedType.Interface)] IDebugDocumentContext2 pDocContext, [In, MarshalAs(UnmanagedType.Interface)] IDebugCodeContext2 pCodeContext); 30 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 31 | int GoToDisassembly([In, MarshalAs(UnmanagedType.Interface)] IDebugCodeContext2 pCodeContext, [In, MarshalAs(UnmanagedType.Interface)] IDebugProgram2 pProgramOfCodeContext); 32 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 33 | int EditBreakpoint([In, MarshalAs(UnmanagedType.Interface)] IBreakpoint pBreakpoint, [In] BREAKPOINT_EDIT_OPERATION op); 34 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 35 | int SetEngineMetric([In] ref Guid engine, [In, MarshalAs(UnmanagedType.BStr)] string metric, [In, MarshalAs(UnmanagedType.Struct)] object var); 36 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 37 | int UpdateAddressMarkers(); 38 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 39 | int DeleteAddressMarkers(); 40 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 41 | int ShowVisualizer([In, ComAliasName("AD7InteropA.DEBUG_PROPERTY_INFO"), MarshalAs(UnmanagedType.LPArray)] DEBUG_PROPERTY_INFO[] data, [In] uint visualizerId); 42 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 43 | int UpdateExpressionValue([In, ComAliasName("AD7InteropA.DEBUG_PROPERTY_INFO"), MarshalAs(UnmanagedType.LPArray)] DEBUG_PROPERTY_INFO[] data, [In, MarshalAs(UnmanagedType.BStr)] string newValue, [MarshalAs(UnmanagedType.BStr)] out string error); 44 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 45 | int CreateObjectID([In, ComAliasName("AD7InteropA.DEBUG_PROPERTY_INFO"), MarshalAs(UnmanagedType.LPArray)] DEBUG_PROPERTY_INFO[] data); 46 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 47 | int DestroyObjectID([In, ComAliasName("AD7InteropA.DEBUG_PROPERTY_INFO"), MarshalAs(UnmanagedType.LPArray)] DEBUG_PROPERTY_INFO[] data); 48 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 49 | int IndicateEvalRequiresRefresh([In, ComAliasName("AD7InteropA.DEBUG_PROPERTY_INFO"), MarshalAs(UnmanagedType.LPArray)] DEBUG_PROPERTY_INFO[] src); 50 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 51 | int RegisterInternalEventSink([In, MarshalAs(UnmanagedType.Interface)] IDebuggerInternalEvents pEvents); 52 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 53 | int UnregisterInternalEventSink([In, MarshalAs(UnmanagedType.Interface)] IDebuggerInternalEvents pEvents); 54 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 55 | int IsProcessActivelyBeingDebugged([In, MarshalAs(UnmanagedType.Interface)] IDebugProcess2 pProcess, out bool retVal); 56 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 57 | int OnCaretMoved(); 58 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 59 | int GetSymbolPathInternal([MarshalAs(UnmanagedType.BStr)] out string pbstrSymbolPath, [MarshalAs(UnmanagedType.BStr)] out string pbstrSymbolCachePath); 60 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 61 | int GetImageInfo([In, MarshalAs(UnmanagedType.BStr)] string imageName, [Out, ComAliasName("Microsoft.VisualStudio.Debugger.Interop.Internal.IMAGEINFO_TYPE"), MarshalAs(UnmanagedType.LPArray)] IMAGEINFO_TYPE[] pImageInfoType); 62 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 63 | int IsInteropSupported([In, MarshalAs(UnmanagedType.BStr)] string imageName); 64 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 65 | int GetErrorMessageByHRESULT([In, MarshalAs(UnmanagedType.Error)] int err, [MarshalAs(UnmanagedType.BStr)] out string bstrErrorMessage); 66 | [DispId(0x6001001c)] 67 | IDebugSession3 CurrentSession { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 68 | [DispId(0x6001001d)] 69 | IDebugProgram2 CurrentProgram { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; [param: In, MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] set; } 70 | [DispId(0x6001001f)] 71 | IDebugThread2 CurrentThread { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; [param: In, MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] set; } 72 | [DispId(0x60010021)] 73 | IEnumDebugFrameInfo2 CurrentStack { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 74 | [DispId(0x60010022)] 75 | IDebugStackFrame2 CurrentStackFrame { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; [param: In, MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] set; } 76 | [DispId(0x60010024)] 77 | IDebugCodeContext2 CurrentCodeContext { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 78 | [DispId(0x60010025)] 79 | IDebugStackFrame2 TopMostStackFrame { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 80 | [DispId(0x60010026)] 81 | IDebugCodeContext2 TopMostCodeContext { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 82 | [DispId(0x60010027)] 83 | bool InDisassemblyMode { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] set; } 84 | [DispId(0x60010029)] 85 | bool InApplyCodeChanges { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 86 | [DispId(0x6001002a)] 87 | bool InBreakMode { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 88 | [DispId(0x6001002b)] 89 | IBreakpointManager BreakpointManager { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 90 | [DispId(0x6001002c)] 91 | bool ArePendingEditsBlockingSetNext { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 92 | [DispId(0x6001002d)] 93 | IDataTipManager DataTipManager { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 94 | [DispId(0x6001002e)] 95 | IDebugProcess2 CurrentRunModeProcess { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] get; } 96 | } 97 | } -------------------------------------------------------------------------------- /ExceptionBreaker/ComImports/IDebuggerInternalEvents.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | using System.Runtime.InteropServices; 3 | 4 | // ReSharper disable CheckNamespace 5 | namespace Microsoft.VisualStudio.Debugger.Interop.Internal { 6 | // ReSharper restore CheckNamespace 7 | [ComImport, Guid("05538AD7-8C70-4905-A21A-D2E72DC16805"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] 8 | public interface IDebuggerInternalEvents { 9 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 10 | int OnSessionCreate([In, MarshalAs(UnmanagedType.Interface)] IDebugSession2 pSession); 11 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 12 | int OnSessionDestroy([In, MarshalAs(UnmanagedType.Interface)] IDebugSession2 pSession); 13 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 14 | int OnProcessRegister([In, MarshalAs(UnmanagedType.Interface)] IDebugCoreServer2 pServer, [In, MarshalAs(UnmanagedType.Interface)] IDebugProcess2 pProcess); 15 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 16 | int OnProcessDeregister([In, MarshalAs(UnmanagedType.Interface)] IDebugCoreServer2 pServer, [In, MarshalAs(UnmanagedType.Interface)] IDebugProcess2 pProcess); 17 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 18 | int OnCurrentProcessChange(); 19 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 20 | int OnCurrentProgramChange(); 21 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 22 | int OnCurrentThreadChange(); 23 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 24 | int OnCurrentFrameChange(); 25 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 26 | int OnCurrentStatementChange(); 27 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 28 | int OnModeChange([In] uint NewDebugMode); 29 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 30 | int OnEnterRunMode(); 31 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 32 | int OnProcessCreate([In, MarshalAs(UnmanagedType.Interface)] IDebugProcess2 pProcess); 33 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 34 | int OnProcessDestroy([In, MarshalAs(UnmanagedType.Interface)] IDebugProcess2 pProcess); 35 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 36 | int OnThreadCreate([In, MarshalAs(UnmanagedType.Interface)] IDebugThread2 pThread); 37 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 38 | int OnThreadDestroy([In, MarshalAs(UnmanagedType.Interface)] IDebugThread2 pThread); 39 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 40 | int OnTimeContextChange(); 41 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 42 | int OnShellModeChange([In] uint NewShellMode); 43 | [PreserveSig, MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] 44 | int OnSetNextStatement(); 45 | } 46 | } -------------------------------------------------------------------------------- /ExceptionBreaker/ComImports/IMAGEINFO_TYPE.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable CheckNamespace 2 | namespace Microsoft.VisualStudio.Debugger.Interop.Internal { 3 | // ReSharper restore CheckNamespace 4 | public enum IMAGEINFO_TYPE { 5 | IMAGEINFO_ANYCPU_PLATFORM = 0x10, 6 | IMAGEINFO_CONSOLE_APPLICATION = 1, 7 | IMAGEINFO_INTEROP_APPLICATION = 8, 8 | IMAGEINFO_MANAGED_APPLICATION = 4, 9 | IMAGEINFO_NATIVE_APPLICATION = 2, 10 | IMAGEINFO_X64_PLATFORM = 0x40, 11 | IMAGEINFO_X86_PLATFORM = 0x20 12 | } 13 | } -------------------------------------------------------------------------------- /ExceptionBreaker/ComImports/ReadMe.txt: -------------------------------------------------------------------------------- 1 | This folder contains manual COM imports from Microsoft.VisualStudio.Debugger.Interop.Internal. 2 | I do not reference this assembly because it creates certain definition conflicts with Microsoft.VisualStudio.Debugger.Interop. 3 | 4 | This is not the whole list of APIs available in Internal assembly -- if you need something else please take a look at it. -------------------------------------------------------------------------------- /ExceptionBreaker/CommandIDs.cs: -------------------------------------------------------------------------------- 1 | // PkgCmdID.cs 2 | // MUST match PkgCmdID.h 3 | 4 | using System; 5 | using System.ComponentModel.Design; 6 | 7 | namespace ExceptionBreaker { 8 | internal static class CommandIDs { 9 | public static readonly CommandID BreakOn = new CommandID(GuidList.CommandSet, 0x100); 10 | }; 11 | } -------------------------------------------------------------------------------- /ExceptionBreaker/ExceptionBreaker.2010.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /ExceptionBreaker/ExceptionBreaker.2012.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /ExceptionBreaker/ExceptionBreaker.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /ExceptionBreaker/ExceptionBreakerPackage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Runtime.InteropServices; 6 | using System.ComponentModel.Design; 7 | using EnvDTE; 8 | using ExceptionBreaker.Implementation; 9 | using ExceptionBreaker.Implementation.VersionSpecific; 10 | using ExceptionBreaker.Options; 11 | using ExceptionBreaker.Options.ImprovedComponentModel; 12 | using Microsoft.VisualStudio.Shell.Interop; 13 | using Microsoft.VisualStudio.Shell; 14 | 15 | namespace ExceptionBreaker 16 | { 17 | /// 18 | /// This is the class that implements the package exposed by this assembly. 19 | /// 20 | /// The minimum requirement for a class to be considered a valid package for Visual Studio 21 | /// is to implement the IVsPackage interface and register itself with the shell. 22 | /// This package uses the helper classes defined inside the Managed Package Framework (MPF) 23 | /// to do it: it derives from the Package class that provides the implementation of the 24 | /// IVsPackage interface and uses the registration attributes defined in the framework to 25 | /// register itself and its components with the shell. 26 | /// 27 | [PackageRegistration(UseManagedResourcesOnly = true)] 28 | [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] 29 | [ProvideAutoLoad(UIContextGuids80.NoSolution)] 30 | [ProvideAutoLoad(UIContextGuids80.SolutionExists)] 31 | [ProvideAutoLoad(UIContextGuids80.Debugging)] 32 | [ProvideMenuResource("Menus.2012.ctmenu", 1)] 33 | [ProvideOptionPageInExistingCategory(typeof(OptionsPageData), "Debugger", "ExceptionBreaker", 110)] 34 | [Guid(GuidList.PackageString)] 35 | public sealed class ExceptionBreakerPackage : Package { 36 | private CommandController _controller; 37 | private DTE _dte; 38 | 39 | public IDiagnosticLogger Logger { get; private set; } 40 | public ExceptionBreakManager ExceptionBreakManager { get; private set; } 41 | 42 | public static ExceptionBreakerPackage Current { get; private set; } 43 | 44 | /// 45 | /// Default constructor of the package. 46 | /// Inside this method you can place any initialization code that does not require 47 | /// any Visual Studio service because at this point the package object is created but 48 | /// not sited yet inside Visual Studio environment. The place to do all the other 49 | /// initialization is the Initialize method. 50 | /// 51 | public ExceptionBreakerPackage() 52 | { 53 | Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this)); 54 | Current = this; 55 | } 56 | 57 | /// 58 | /// Initialization of the package; this method is called right after the package is sited, so this is the place 59 | /// where you can put all the initialization code that rely on services provided by VisualStudio. 60 | /// 61 | protected override void Initialize() 62 | { 63 | Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this)); 64 | base.Initialize(); 65 | Logger = new ExtensionLogger("ExceptionBreaker", this, GuidList.OutputPane); 66 | 67 | _dte = (DTE)GetService(typeof(DTE)); 68 | SetupExceptionBreakManager(); 69 | 70 | // Add our command handlers for menu (commands must exist in the .vsct file) 71 | SetupCommandController(); 72 | } 73 | 74 | private void SetupExceptionBreakManager() { 75 | var versionSpecificFactory = new VersionSpecificAdapterFactory(_dte); 76 | var debugger = GetGlobalService(typeof (SVsShellDebugger)); 77 | var sessionManager = new DebugSessionManager(versionSpecificFactory.AdaptDebuggerInternal(debugger), Logger); 78 | var optionsPage = new Lazy(() => (OptionsPageData)GetDialogPage(typeof (OptionsPageData))); 79 | ExceptionBreakManager = new ExceptionBreakManager( 80 | sessionManager, 81 | name => optionsPage.Value.Ignored.Any(p => p.Matches(name)), 82 | Logger 83 | ); 84 | } 85 | 86 | private void SetupCommandController() { 87 | var menuCommandService = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; 88 | Func initBreakOnAllCommand = callback => { 89 | var command = new OleMenuCommand(id: CommandIDs.BreakOn, invokeHandler: callback); 90 | menuCommandService.AddCommand(command); 91 | 92 | return command; 93 | }; 94 | 95 | var monitorSelection = (IVsMonitorSelection)this.GetService(typeof(IVsMonitorSelection)); 96 | _controller = new CommandController(_dte, initBreakOnAllCommand, monitorSelection, ExceptionBreakManager, Logger); 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /ExceptionBreaker/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // This file is used by Code Analysis to maintain SuppressMessage 2 | // attributes that are applied to this project. Project-level 3 | // suppressions either have no target or are given a specific target 4 | // and scoped to a namespace, type, member, etc. 5 | // 6 | // To add a suppression to this file, right-click the message in the 7 | // Error List, point to "Suppress Message(s)", and click "In Project 8 | // Suppression File". You do not need to add suppressions to this 9 | // file manually. 10 | 11 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1017:MarkAssembliesWithComVisible")] 12 | -------------------------------------------------------------------------------- /ExceptionBreaker/Guids.cs: -------------------------------------------------------------------------------- 1 | // Guids.cs 2 | // MUST match guids.h 3 | 4 | using System; 5 | 6 | namespace ExceptionBreaker 7 | { 8 | internal static class GuidList 9 | { 10 | public const string PackageString = "a83e8a33-e775-4a79-be41-efe20007eebd"; 11 | public const string CommandSetString = "9d55da8f-2be1-44dc-a94a-08154f98f634"; 12 | 13 | public static readonly Guid CommandSet = new Guid(CommandSetString); 14 | public static readonly Guid OutputPane = new Guid("fb57af1a-e1f6-4a87-97f6-0b1d4add8e24"); 15 | }; 16 | } -------------------------------------------------------------------------------- /ExceptionBreaker/Implementation/CommandController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.Design; 4 | using System.Linq; 5 | using System.Runtime.InteropServices; 6 | using System.Windows.Forms; 7 | using EnvDTE; 8 | using Microsoft.VisualStudio; 9 | using Microsoft.VisualStudio.Shell.Interop; 10 | 11 | namespace ExceptionBreaker.Implementation { 12 | /// 13 | /// Handles state (enabled, visible, checked) and click events for the BreakOnAllCommand. 14 | /// 15 | public class CommandController : IVsSelectionEvents, IDisposable { 16 | private static readonly HashSet RequiredUIContexts = new HashSet { 17 | VSConstants.UICONTEXT.Debugging_guid, 18 | VSConstants.UICONTEXT.SolutionExists_guid 19 | }; 20 | 21 | private readonly MenuCommand _breakOnAllCommand; 22 | private readonly IVsMonitorSelection _monitorSelection; 23 | private readonly ExceptionBreakManager _breakManager; 24 | private readonly IDiagnosticLogger _logger; 25 | private readonly CommandEvents _debugExceptionsEvents; 26 | 27 | private readonly uint _selectionEventsCookie; 28 | 29 | private readonly HashSet _requiredUiContextCookies; 30 | private readonly HashSet _currentlyActiveUiContextCookies = new HashSet(); 31 | 32 | public CommandController(DTE dte, 33 | Func initBreakOnAllCommand, 34 | IVsMonitorSelection monitorSelection, 35 | ExceptionBreakManager breakManager, 36 | IDiagnosticLogger logger) 37 | { 38 | _monitorSelection = monitorSelection; 39 | _breakManager = breakManager; 40 | _logger = logger; 41 | _breakOnAllCommand = initBreakOnAllCommand(breakOnAllCommand_Callback); 42 | 43 | _requiredUiContextCookies = new HashSet(RequiredUIContexts.Select(ConvertToUIContextCookie)); 44 | 45 | UpdateCommandAvailability(); 46 | _selectionEventsCookie = SubscribeToSelectionEvents(); 47 | 48 | UpdateCommandCheckedState(); 49 | _breakManager.CurrentStateChanged += breakManager_CurrentStateChanged; 50 | 51 | _debugExceptionsEvents = SubscribeToDebugExceptionsCommand(dte); 52 | } 53 | 54 | private uint SubscribeToSelectionEvents() { 55 | uint cookie; 56 | var hr = _monitorSelection.AdviseSelectionEvents(this, out cookie); 57 | if (hr != VSConstants.S_OK) 58 | Marshal.ThrowExceptionForHR(hr); 59 | 60 | return cookie; 61 | } 62 | 63 | private CommandEvents SubscribeToDebugExceptionsCommand(DTE dte) { 64 | var events = dte.Events.CommandEvents[ 65 | typeof(VSConstants.VSStd97CmdID).GUID.ToString("B"), 66 | (int)VSConstants.VSStd97CmdID.Exceptions 67 | ]; 68 | events.AfterExecute += debugExceptionsEvents_AfterExecute; 69 | 70 | return events; 71 | } 72 | 73 | private uint ConvertToUIContextCookie(Guid guid) { 74 | uint cookie; 75 | var hr = _monitorSelection.GetCmdUIContextCookie(ref guid, out cookie); 76 | if (hr != VSConstants.S_OK) 77 | Marshal.ThrowExceptionForHR(hr); 78 | 79 | _logger.WriteLine("Mapped UI context {0} to cookie {1}.", guid, cookie); 80 | return cookie; 81 | } 82 | 83 | private void debugExceptionsEvents_AfterExecute(string Guid, int ID, object CustomIn, object CustomOut) { 84 | _logger.WriteLine("Debug.Exceptions was just executed."); 85 | _breakManager.RefreshCurrentState(); 86 | } 87 | 88 | private void breakOnAllCommand_Callback(object sender, EventArgs e) { 89 | try { 90 | var targetState = _breakManager.CurrentState != ExceptionBreakState.BreakOnAll 91 | ? ExceptionBreakState.BreakOnAll 92 | : ExceptionBreakState.BreakOnNone; 93 | 94 | _logger.WriteLine("Command: toggled, current = {0}, new = {1}.", _breakManager.CurrentState, targetState); 95 | _breakManager.CurrentState = targetState; 96 | } 97 | catch (Exception ex) { 98 | _logger.WriteLine("Unexpected exception: " + ex); 99 | MessageBox.Show(ex.Message, "Error in ExceptionBreaker extension", MessageBoxButtons.OK, MessageBoxIcon.Error); 100 | } 101 | } 102 | 103 | private void breakManager_CurrentStateChanged(object sender, EventArgs eventArgs) { 104 | UpdateCommandCheckedState(); 105 | } 106 | 107 | public int OnCmdUIContextChanged(uint dwCmdUICookie, int fActive) { 108 | try { 109 | var active = (fActive != 0); 110 | if (active) { 111 | _currentlyActiveUiContextCookies.Add(dwCmdUICookie); 112 | } 113 | else { 114 | _currentlyActiveUiContextCookies.Remove(dwCmdUICookie); 115 | } 116 | 117 | UpdateCommandAvailability(); 118 | return VSConstants.S_OK; 119 | } 120 | catch (Exception ex) { 121 | _logger.WriteLine("Unexpected exception: " + ex); 122 | return VSConstants.E_FAIL; 123 | } 124 | } 125 | 126 | private void UpdateCommandAvailability() { 127 | var enabledVisible = _requiredUiContextCookies.Intersect(_currentlyActiveUiContextCookies).Any(); 128 | 129 | var command = _breakOnAllCommand; 130 | if (command.Enabled == enabledVisible) // Visible is always synchronized 131 | return; 132 | 133 | command.Enabled = enabledVisible; 134 | command.Visible = enabledVisible; 135 | _logger.WriteLine("Command: change of state, enabled = {0}, visible = {0}.", enabledVisible); 136 | } 137 | 138 | private void UpdateCommandCheckedState() { 139 | var @checked = (_breakManager.CurrentState == ExceptionBreakState.BreakOnAll); 140 | if (_breakOnAllCommand.Checked == @checked) 141 | return; 142 | 143 | _breakOnAllCommand.Checked = @checked; 144 | _logger.WriteLine("Command: change of state, checked = {0}.", @checked); 145 | } 146 | 147 | public void Dispose() { 148 | // not completely implemented, please ignore for now 149 | _monitorSelection.UnadviseSelectionEvents(_selectionEventsCookie); 150 | 151 | _debugExceptionsEvents.AfterExecute -= debugExceptionsEvents_AfterExecute; 152 | _breakManager.CurrentStateChanged -= breakManager_CurrentStateChanged; 153 | } 154 | 155 | #region IVsSelectionEvents Members 156 | 157 | int IVsSelectionEvents.OnElementValueChanged(uint elementid, object varValueOld, object varValueNew) { 158 | return VSConstants.S_OK; 159 | } 160 | 161 | int IVsSelectionEvents.OnSelectionChanged(IVsHierarchy pHierOld, uint itemidOld, IVsMultiItemSelect pMISOld, ISelectionContainer pSCOld, IVsHierarchy pHierNew, uint itemidNew, IVsMultiItemSelect pMISNew, ISelectionContainer pSCNew) { 162 | return VSConstants.S_OK; 163 | } 164 | 165 | #endregion 166 | } 167 | } -------------------------------------------------------------------------------- /ExceptionBreaker/Implementation/DebugSessionEventSink.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Microsoft.VisualStudio; 5 | using Microsoft.VisualStudio.Debugger.Interop; 6 | using Microsoft.VisualStudio.Debugger.Interop.Internal; 7 | 8 | namespace ExceptionBreaker.Implementation { 9 | public class DebugSessionEventSink : IDebuggerInternalEvents { 10 | public event EventHandler SessionCreated = delegate { }; 11 | public event EventHandler SessionDestroyed = delegate { }; 12 | 13 | public int OnSessionCreate(IDebugSession2 pSession) { 14 | SessionCreated(this, EventArgs.Empty); 15 | return VSConstants.S_OK; 16 | } 17 | 18 | public int OnSessionDestroy(IDebugSession2 pSession) { 19 | SessionDestroyed(this, EventArgs.Empty); 20 | return VSConstants.S_OK; 21 | } 22 | 23 | #region IDebuggerInternalEvents Members 24 | 25 | int IDebuggerInternalEvents.OnProcessRegister(IDebugCoreServer2 pServer, IDebugProcess2 pProcess) { 26 | return VSConstants.S_OK; 27 | } 28 | 29 | int IDebuggerInternalEvents.OnProcessDeregister(IDebugCoreServer2 pServer, IDebugProcess2 pProcess) { 30 | return VSConstants.S_OK; 31 | } 32 | 33 | int IDebuggerInternalEvents.OnCurrentProcessChange() { 34 | return VSConstants.S_OK; 35 | } 36 | 37 | int IDebuggerInternalEvents.OnCurrentProgramChange() { 38 | return VSConstants.S_OK; 39 | } 40 | 41 | int IDebuggerInternalEvents.OnCurrentThreadChange() { 42 | return VSConstants.S_OK; 43 | } 44 | 45 | int IDebuggerInternalEvents.OnCurrentFrameChange() { 46 | return VSConstants.S_OK; 47 | } 48 | 49 | int IDebuggerInternalEvents.OnCurrentStatementChange() { 50 | return VSConstants.S_OK; 51 | } 52 | 53 | int IDebuggerInternalEvents.OnModeChange(uint NewDebugMode) { 54 | return VSConstants.S_OK; 55 | } 56 | 57 | int IDebuggerInternalEvents.OnEnterRunMode() { 58 | return VSConstants.S_OK; 59 | } 60 | 61 | int IDebuggerInternalEvents.OnProcessCreate(IDebugProcess2 pProcess) { 62 | return VSConstants.S_OK; 63 | } 64 | 65 | int IDebuggerInternalEvents.OnProcessDestroy(IDebugProcess2 pProcess) { 66 | return VSConstants.S_OK; 67 | } 68 | 69 | int IDebuggerInternalEvents.OnThreadCreate(IDebugThread2 pThread) { 70 | return VSConstants.S_OK; 71 | } 72 | 73 | int IDebuggerInternalEvents.OnThreadDestroy(IDebugThread2 pThread) { 74 | return VSConstants.S_OK; 75 | } 76 | 77 | int IDebuggerInternalEvents.OnTimeContextChange() { 78 | return VSConstants.S_OK; 79 | } 80 | 81 | int IDebuggerInternalEvents.OnShellModeChange(uint NewShellMode) { 82 | return VSConstants.S_OK; 83 | } 84 | 85 | int IDebuggerInternalEvents.OnSetNextStatement() { 86 | return VSConstants.S_OK; 87 | } 88 | 89 | #endregion 90 | } 91 | } -------------------------------------------------------------------------------- /ExceptionBreaker/Implementation/DebugSessionManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using ExceptionBreaker.Implementation.VersionSpecific; 6 | using Microsoft.VisualStudio; 7 | using Microsoft.VisualStudio.Debugger.Interop; 8 | 9 | namespace ExceptionBreaker.Implementation { 10 | /// 11 | /// Monitors debug session create/destroy events and maintains session between them. 12 | /// 13 | public class DebugSessionManager : IDisposable { 14 | public event EventHandler DebugSessionChanged = delegate {}; 15 | 16 | private readonly IDebuggerInternalAdapter _debugger; 17 | private readonly IDiagnosticLogger _logger; 18 | private readonly DebugSessionEventSink _eventSink; 19 | 20 | public DebugSessionManager(IDebuggerInternalAdapter debugger, IDiagnosticLogger logger) { 21 | _debugger = debugger; 22 | _logger = logger; 23 | 24 | _eventSink = new DebugSessionEventSink(); 25 | _eventSink.SessionCreated += (sender, args) => ProcessSessionCreateOrDestoryEvent("created"); 26 | _eventSink.SessionDestroyed += (sender, args) => ProcessSessionCreateOrDestoryEvent("destroyed"); 27 | 28 | var hr = _debugger.RegisterInternalEventSink(_eventSink); 29 | if (hr != VSConstants.S_OK) 30 | Marshal.ThrowExceptionForHR(hr); 31 | } 32 | 33 | public IDebugSession2 DebugSession { 34 | get { return _debugger.CurrentSession; } 35 | } 36 | 37 | private void ProcessSessionCreateOrDestoryEvent(string logSessionAs) { 38 | _logger.WriteLine("Event: Debug session {0}.", logSessionAs); 39 | DebugSessionChanged(this, EventArgs.Empty); 40 | } 41 | 42 | public void Dispose() { 43 | _debugger.UnregisterInternalEventSink(_eventSink); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /ExceptionBreaker/Implementation/ExceptionBreakManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Runtime.InteropServices; 6 | using Microsoft.VisualStudio; 7 | using Microsoft.VisualStudio.Debugger.Interop; 8 | 9 | namespace ExceptionBreaker.Implementation { 10 | /// 11 | /// Manages current break state and applies state changes to . 12 | /// 13 | public class ExceptionBreakManager : IExceptionListProvider { 14 | // Note: I did not research any specific differences between JustMyCode=On/Off. 15 | // the constants below seem to work well enough, but I would not be surprised if 16 | // there is something I have not noticed 17 | 18 | private const enum_EXCEPTION_STATE VSExceptionStateStopAll = 19 | enum_EXCEPTION_STATE.EXCEPTION_STOP_FIRST_CHANCE 20 | | enum_EXCEPTION_STATE.EXCEPTION_STOP_SECOND_CHANCE 21 | | enum_EXCEPTION_STATE.EXCEPTION_JUST_MY_CODE_SUPPORTED 22 | | enum_EXCEPTION_STATE.EXCEPTION_STOP_USER_FIRST_CHANCE 23 | | enum_EXCEPTION_STATE.EXCEPTION_STOP_USER_UNCAUGHT; 24 | 25 | private const enum_EXCEPTION_STATE VSExceptionStateStopAllInfer = 26 | enum_EXCEPTION_STATE.EXCEPTION_STOP_FIRST_CHANCE 27 | | enum_EXCEPTION_STATE.EXCEPTION_STOP_SECOND_CHANCE 28 | | enum_EXCEPTION_STATE.EXCEPTION_STOP_USER_FIRST_CHANCE; 29 | 30 | // I honestly do not understand this one yet. 31 | // However it is equivalent to what Debug->Exceptions window does. 32 | private const enum_EXCEPTION_STATE VSExceptionStateStopNotSet = 33 | enum_EXCEPTION_STATE.EXCEPTION_STOP_SECOND_CHANCE 34 | | enum_EXCEPTION_STATE.EXCEPTION_JUST_MY_CODE_SUPPORTED; 35 | 36 | public event EventHandler CurrentStateChanged = delegate { }; 37 | public event EventHandler ExceptionNamesChanged = delegate { }; 38 | 39 | private readonly DebugSessionManager _sessionManager; 40 | private readonly Func _ignorePredicate; 41 | private readonly IDiagnosticLogger _logger; 42 | 43 | private ICollection _exceptionCache; 44 | private ExceptionBreakState _currentState; 45 | 46 | public ExceptionBreakManager(DebugSessionManager sessionManager, Func ignorePredicate, IDiagnosticLogger logger) { 47 | _sessionManager = sessionManager; 48 | _ignorePredicate = ignorePredicate; 49 | _logger = logger; 50 | 51 | if (Session != null) 52 | _currentState = GetStateFromSession(); 53 | _sessionManager.DebugSessionChanged += sessionManager_DebugSessionChanged; 54 | } 55 | 56 | // Just for convenience 57 | private IDebugSession2 Session { 58 | get { return _sessionManager.DebugSession; } 59 | } 60 | 61 | public ExceptionBreakState CurrentState { 62 | get { return _currentState; } 63 | set { 64 | if (_currentState == value) 65 | return; 66 | 67 | _logger.WriteLine("Manager: CurrentState is being set to {0}.", value); 68 | 69 | if (Session != null) 70 | EnsureManagedExceptionCache(); 71 | 72 | if (value == ExceptionBreakState.BreakOnAll || value == ExceptionBreakState.BreakOnNone) { 73 | if (_exceptionCache == null) { 74 | _logger.WriteLine("Manager: Cache not available, cannot apply state to session."); 75 | return; 76 | } 77 | 78 | ApplyStateToSession(value); 79 | } 80 | 81 | _currentState = value; 82 | _logger.WriteLine("Manager: CurrentState was set to {0}.", value); 83 | CurrentStateChanged(this, EventArgs.Empty); 84 | } 85 | } 86 | 87 | public IEnumerable GetExceptionNames() { 88 | if (Session == null) 89 | return Enumerable.Empty(); 90 | 91 | EnsureManagedExceptionCache(); 92 | return _exceptionCache.Select(e => e.bstrExceptionName); 93 | } 94 | 95 | public void RefreshCurrentState() { 96 | // not using property here as it would try to re-apply state 97 | _currentState = GetStateFromSession(); 98 | CurrentStateChanged(this, EventArgs.Empty); 99 | } 100 | 101 | private void sessionManager_DebugSessionChanged(object sender, EventArgs e) { 102 | if (Session == null) 103 | return; 104 | 105 | EnsureManagedExceptionCache(); 106 | if (_currentState == ExceptionBreakState.Inconclusive || _currentState == ExceptionBreakState.Unknown) 107 | RefreshCurrentState(); 108 | } 109 | 110 | private void EnsureManagedExceptionCache() { 111 | if (_exceptionCache != null) 112 | return; 113 | 114 | var guid = VSConstants.DebugEnginesGuids.ManagedOnly_guid; 115 | 116 | var root = GetDefaultExceptions(); 117 | var list = new List(root.Where(e => e.guidType == guid)); 118 | var index = 0; 119 | 120 | while (index < list.Count) { 121 | var children = GetDefaultExceptions(list[index]); 122 | list.AddRange(children); 123 | 124 | index += 1; 125 | } 126 | 127 | _exceptionCache = list; 128 | _logger.WriteLine("Exception cache is built: {0} exceptions.", _exceptionCache.Count); 129 | ExceptionNamesChanged(this, EventArgs.Empty); 130 | } 131 | 132 | /// 133 | /// Gets full list of child exceptions under given . 134 | /// The exceptions will not have a specific state set. 135 | /// 136 | private EXCEPTION_INFO[] GetDefaultExceptions(EXCEPTION_INFO? parent = null) { 137 | IEnumDebugExceptionInfo2 enumerator; 138 | var hr = Session.EnumDefaultExceptions(parent != null ? new[] { parent.Value } : null, out enumerator); 139 | 140 | return GetExceptionsFromEnumerator(hr, enumerator); 141 | } 142 | 143 | /// 144 | /// Gets list of all managed exceptions that were *set*. It is hard to understand what exactly 145 | /// *set* means in this context, as it returns non-set exception in certain cases. 146 | /// 147 | private EXCEPTION_INFO[] GetSetManagedExceptions() { 148 | var guid = VSConstants.DebugEnginesGuids.ManagedOnly_guid; 149 | 150 | IEnumDebugExceptionInfo2 enumerator; 151 | var hr = Session.EnumSetExceptions(null, null, guid, out enumerator); 152 | 153 | return GetExceptionsFromEnumerator(hr, enumerator); 154 | } 155 | 156 | private static EXCEPTION_INFO[] GetExceptionsFromEnumerator(int enumHResult, IEnumDebugExceptionInfo2 enumerator) { 157 | if (enumHResult == VSConstants.S_FALSE) 158 | return new EXCEPTION_INFO[0]; 159 | 160 | if (enumHResult != VSConstants.S_OK) 161 | Marshal.ThrowExceptionForHR(enumHResult); 162 | 163 | uint count; 164 | var hr = enumerator.GetCount(out count); 165 | if (hr != VSConstants.S_OK) 166 | Marshal.ThrowExceptionForHR(hr); 167 | 168 | if (count == 0) 169 | return new EXCEPTION_INFO[0]; 170 | 171 | var buffer = new EXCEPTION_INFO[count]; 172 | var countFetched = 0U; 173 | hr = enumerator.Next(count, buffer, ref countFetched); 174 | if (hr != VSConstants.S_OK) 175 | Marshal.ThrowExceptionForHR(hr); 176 | 177 | return buffer; 178 | } 179 | 180 | private ExceptionBreakState GetStateFromSession() { 181 | var inferredState = ExceptionBreakState.Unknown; 182 | var exceptionThatCausedChangeFromUnknown = new EXCEPTION_INFO(); 183 | 184 | foreach (var exception in GetSetManagedExceptions()) { 185 | if (_ignorePredicate(exception.bstrExceptionName)) 186 | continue; 187 | 188 | var @break = (((enum_EXCEPTION_STATE)exception.dwState & VSExceptionStateStopAllInfer) == VSExceptionStateStopAllInfer); 189 | var stateFromException = @break ? ExceptionBreakState.BreakOnAll : ExceptionBreakState.BreakOnNone; 190 | 191 | if (inferredState == ExceptionBreakState.Unknown) { 192 | inferredState = stateFromException; 193 | exceptionThatCausedChangeFromUnknown = exception; 194 | continue; 195 | } 196 | 197 | if (inferredState != stateFromException) { 198 | _logger.WriteLine("Manager: inconclusive state diagnostic."); 199 | _logger.WriteLine(" Previous state: {0}.", inferredState); 200 | _logger.WriteLine(" Previous exception: {0}; {1}.", exceptionThatCausedChangeFromUnknown.bstrExceptionName, (enum_EXCEPTION_STATE)exceptionThatCausedChangeFromUnknown.dwState); 201 | _logger.WriteLine(" Conflicting state: {0}.", stateFromException); 202 | _logger.WriteLine(" Conflicting exception: {0}; {1}.", exception.bstrExceptionName, (enum_EXCEPTION_STATE)exception.dwState); 203 | 204 | inferredState = ExceptionBreakState.Inconclusive; 205 | break; 206 | } 207 | } 208 | 209 | _logger.WriteLine("Manager: inferred state is {0}.", inferredState); 210 | return inferredState; 211 | } 212 | 213 | private void ApplyStateToSession(ExceptionBreakState state) { 214 | const int SkippedExceptionLogLimit = 25; 215 | 216 | _logger.WriteLine("Manager: Applying {0} to debug session.", state); 217 | var stopwatch = new Stopwatch(); 218 | stopwatch.Start(); 219 | 220 | var newExceptionState = (state == ExceptionBreakState.BreakOnAll) 221 | ? (uint)VSExceptionStateStopAll 222 | : (uint)VSExceptionStateStopNotSet; 223 | 224 | var guid = Guid.Empty; 225 | var hr = Session.RemoveAllSetExceptions(ref guid); 226 | if (hr != VSConstants.S_OK) 227 | Marshal.ThrowExceptionForHR(hr); 228 | 229 | var updated = new EXCEPTION_INFO[1]; 230 | var skippedExceptionCount = 0; 231 | foreach (var exception in _exceptionCache) { 232 | if (_ignorePredicate(exception.bstrExceptionName)) { 233 | if (skippedExceptionCount < SkippedExceptionLogLimit) 234 | _logger.WriteLine(" Skipped exception {0} (matches ignore rule).", exception.bstrExceptionName); 235 | 236 | skippedExceptionCount += 1; 237 | continue; 238 | } 239 | 240 | updated[0] = new EXCEPTION_INFO { 241 | guidType = exception.guidType, 242 | bstrExceptionName = exception.bstrExceptionName, 243 | dwState = newExceptionState 244 | }; 245 | 246 | hr = Session.SetException(updated); 247 | if (hr != VSConstants.S_OK) 248 | Marshal.ThrowExceptionForHR(hr); 249 | } 250 | 251 | if (skippedExceptionCount > SkippedExceptionLogLimit) 252 | _logger.WriteLine(" Skipped {0} more exceptions (match ignore rule).", skippedExceptionCount - SkippedExceptionLogLimit); 253 | 254 | stopwatch.Stop(); 255 | _logger.WriteLine(" Finished in {0}ms.", stopwatch.ElapsedMilliseconds); 256 | } 257 | } 258 | } 259 | -------------------------------------------------------------------------------- /ExceptionBreaker/Implementation/ExceptionBreakState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace ExceptionBreaker.Implementation { 6 | public enum ExceptionBreakState { 7 | /// 8 | /// Either the session was not available yet, or the session does not have any exceptions *set*, 9 | /// whatever this means (not the same thing as *set to do not break*). 10 | /// 11 | Unknown, 12 | 13 | /// 14 | /// Some exception breaks are set, but not on all of them. This state is inferred, but can not be 15 | /// set by the user. 16 | /// 17 | Inconclusive, 18 | 19 | /// 20 | /// Break on all managed exceptions. This state can be set by the user. 21 | /// 22 | BreakOnAll, 23 | 24 | /// 25 | /// Do not break on any managed exceptions. This state can be st by the user. 26 | /// 27 | BreakOnNone 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ExceptionBreaker/Implementation/ExtensionLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using Microsoft.VisualStudio; 5 | using Microsoft.VisualStudio.Shell.Interop; 6 | 7 | namespace ExceptionBreaker.Implementation { 8 | public class ExtensionLogger : IDiagnosticLogger { 9 | private readonly string _traceCategory; 10 | private readonly IServiceProvider _serviceProvider; 11 | private readonly Guid _outputPaneGuid; 12 | private readonly string _outputPaneCaption; 13 | 14 | public ExtensionLogger(string name, IServiceProvider serviceProvider, Guid outputPaneGuid) { 15 | _traceCategory = name; 16 | _serviceProvider = serviceProvider; 17 | _outputPaneGuid = outputPaneGuid; 18 | _outputPaneCaption = "Ext: " + _traceCategory + " (Diagnostic)"; 19 | } 20 | 21 | public void WriteLine(string message) { 22 | var outputPane = GetOutputPane(); 23 | if (outputPane != null) 24 | outputPane.OutputString(message + Environment.NewLine); 25 | 26 | Trace.WriteLine(message, _traceCategory); 27 | } 28 | 29 | public void WriteLine(string format, params object[] args) { 30 | WriteLine(string.Format(format, args)); 31 | } 32 | 33 | public void WriteLine(string format, object arg1) { 34 | WriteLine(string.Format(format, arg1)); 35 | } 36 | 37 | public void WriteLine(string format, object arg1, object arg2) { 38 | WriteLine(string.Format(format, arg1, arg2)); 39 | } 40 | 41 | private IVsOutputWindowPane GetOutputPane() { 42 | var outputWindow = (IVsOutputWindow)_serviceProvider.GetService(typeof(SVsOutputWindow)); 43 | if (outputWindow == null) 44 | return null; 45 | 46 | var guid = _outputPaneGuid; 47 | var pane = (IVsOutputWindowPane)null; 48 | var hr = outputWindow.GetPane(ref guid, out pane); 49 | if (hr != VSConstants.E_FAIL && hr != VSConstants.E_INVALIDARG) 50 | VSInteropHelper.Validate(hr); 51 | 52 | if (pane == null) { 53 | VSInteropHelper.Validate(outputWindow.CreatePane(ref guid, _outputPaneCaption, 1, 1)); 54 | VSInteropHelper.Validate(outputWindow.GetPane(ref guid, out pane)); 55 | } 56 | 57 | VSInteropHelper.Validate(pane.Activate()); 58 | return pane; 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /ExceptionBreaker/Implementation/IDiagnosticLogger.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | 3 | namespace ExceptionBreaker.Implementation { 4 | public interface IDiagnosticLogger { 5 | void WriteLine(string message); 6 | void WriteLine(string format, params object[] args); 7 | void WriteLine(string format, object arg1); 8 | void WriteLine(string format, object arg1, object arg2); 9 | } 10 | } -------------------------------------------------------------------------------- /ExceptionBreaker/Implementation/IExceptionListProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace ExceptionBreaker.Implementation { 5 | public interface IExceptionListProvider { 6 | event EventHandler ExceptionNamesChanged; 7 | IEnumerable GetExceptionNames(); 8 | } 9 | } -------------------------------------------------------------------------------- /ExceptionBreaker/Implementation/VSInteropHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using Microsoft.VisualStudio; 6 | 7 | namespace ExceptionBreaker.Implementation { 8 | public static class VSInteropHelper { 9 | public static void Validate(int hresult) { 10 | if (hresult != VSConstants.S_OK) 11 | Marshal.ThrowExceptionForHR(hresult); 12 | } 13 | 14 | public static void Release(object comObject) { 15 | if (comObject == null) 16 | return; 17 | 18 | Marshal.ReleaseComObject(comObject); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /ExceptionBreaker/Implementation/VersionSpecific/DebuggerInternal10Adapter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.Debugger.Interop; 5 | using Microsoft.VisualStudio.Debugger.Interop.Internal; 6 | 7 | namespace ExceptionBreaker.Implementation.VersionSpecific { 8 | public class DebuggerInternal10Adapter : IDebuggerInternalAdapter { 9 | private readonly IDebuggerInternal10 _debugger; 10 | 11 | public DebuggerInternal10Adapter(IDebuggerInternal10 debugger) { 12 | _debugger = debugger; 13 | } 14 | 15 | public IDebugSession3 CurrentSession { 16 | get { return _debugger.CurrentSession; } 17 | } 18 | 19 | public int RegisterInternalEventSink(DebugSessionEventSink pEvents) { 20 | return _debugger.RegisterInternalEventSink(pEvents); 21 | } 22 | 23 | public int UnregisterInternalEventSink(DebugSessionEventSink pEvents) { 24 | return _debugger.UnregisterInternalEventSink(pEvents); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ExceptionBreaker/Implementation/VersionSpecific/DebuggerInternal11Adapter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.Debugger.Interop; 5 | using Microsoft.VisualStudio.Debugger.Interop.Internal; 6 | 7 | namespace ExceptionBreaker.Implementation.VersionSpecific { 8 | public class DebuggerInternal11Adapter : IDebuggerInternalAdapter { 9 | private readonly IDebuggerInternal11 _debugger; 10 | 11 | public DebuggerInternal11Adapter(IDebuggerInternal11 debugger) { 12 | _debugger = debugger; 13 | } 14 | 15 | public IDebugSession3 CurrentSession { 16 | get { return _debugger.CurrentSession; } 17 | } 18 | 19 | public int RegisterInternalEventSink(DebugSessionEventSink pEvents) { 20 | return _debugger.RegisterInternalEventSink(pEvents); 21 | } 22 | 23 | public int UnregisterInternalEventSink(DebugSessionEventSink pEvents) { 24 | return _debugger.UnregisterInternalEventSink(pEvents); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ExceptionBreaker/Implementation/VersionSpecific/IDebuggerInternalAdapter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Microsoft.VisualStudio.Debugger.Interop; 5 | 6 | namespace ExceptionBreaker.Implementation.VersionSpecific { 7 | public interface IDebuggerInternalAdapter { 8 | IDebugSession3 CurrentSession { get; } 9 | int RegisterInternalEventSink(DebugSessionEventSink eventSink); 10 | int UnregisterInternalEventSink(DebugSessionEventSink eventSink); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ExceptionBreaker/Implementation/VersionSpecific/VersionSpecificAdapterFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using EnvDTE; 5 | using Microsoft.VisualStudio.Debugger.Interop.Internal; 6 | 7 | namespace ExceptionBreaker.Implementation.VersionSpecific { 8 | public class VersionSpecificAdapterFactory { 9 | private readonly Version _version; 10 | 11 | public VersionSpecificAdapterFactory(DTE dte) { 12 | _version = new Version(dte.Version); 13 | } 14 | 15 | public IDebuggerInternalAdapter AdaptDebuggerInternal(object debugger) { 16 | if (_version.Major >= 11) 17 | return new DebuggerInternal11Adapter((IDebuggerInternal11)debugger); 18 | 19 | if (_version.Major == 10) 20 | return new DebuggerInternal10Adapter((IDebuggerInternal10)debugger); 21 | 22 | throw new NotSupportedException("Visual Studio version " + _version + " is not supported."); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ExceptionBreaker/Options/ExceptionViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ExceptionBreaker.Options.Support; 3 | 4 | namespace ExceptionBreaker.Options { 5 | public class ExceptionViewModel { 6 | public ExceptionViewModel(string name, ObservableValue selected) { 7 | Name = name; 8 | MatchesSelected = selected.GetObservable( 9 | s => s != null && !s.IsEmpty.Value && s.Data.Matches(name), 10 | (newItem, oldItem, changed) => { 11 | var handler = (EventHandler)delegate { changed(); }; 12 | if (oldItem != null) { 13 | oldItem.Pattern.ValueChanged -= handler; 14 | oldItem.Enabled.ValueChanged -= handler; 15 | } 16 | 17 | if (newItem != null) { 18 | newItem.Pattern.ValueChanged += handler; 19 | newItem.Enabled.ValueChanged += handler; 20 | } 21 | } 22 | ); 23 | } 24 | 25 | public string Name { get; private set; } 26 | public IObservableResult MatchesSelected { get; private set; } 27 | } 28 | } -------------------------------------------------------------------------------- /ExceptionBreaker/Options/FailSafeJsonTypeConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Globalization; 5 | using Newtonsoft.Json; 6 | using Newtonsoft.Json.Converters; 7 | 8 | namespace ExceptionBreaker.Options { 9 | public class FailSafeJsonTypeConverter : TypeConverter { 10 | private readonly Type _targetType; 11 | 12 | public FailSafeJsonTypeConverter(Type targetType) { 13 | _targetType = targetType; 14 | } 15 | 16 | private static readonly JsonSerializerSettings JsonSettings = new JsonSerializerSettings { 17 | Formatting = Formatting.None, 18 | Converters = { new StringEnumConverter() } 19 | }; 20 | 21 | public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { 22 | return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType); 23 | } 24 | 25 | public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { 26 | var stringValue = value as string; 27 | if (stringValue != null) { 28 | try { 29 | return JsonConvert.DeserializeObject(stringValue, _targetType, JsonSettings); 30 | } 31 | catch (JsonException) { 32 | return null; 33 | } 34 | } 35 | 36 | return base.ConvertFrom(context, culture, value); 37 | } 38 | 39 | public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { 40 | return destinationType == typeof(string) || base.CanConvertTo(context, destinationType); 41 | } 42 | 43 | public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { 44 | if (destinationType == typeof (string)) 45 | return JsonConvert.SerializeObject(value, JsonSettings); 46 | 47 | return base.ConvertTo(context, culture, value, destinationType); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /ExceptionBreaker/Options/ImprovedComponentModel/CustomPropertyDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | 4 | namespace ExceptionBreaker.Options.ImprovedComponentModel { 5 | public class CustomPropertyDescriptor : PropertyDescriptor { 6 | private readonly PropertyDescriptor _parent; 7 | 8 | public CustomPropertyDescriptor(PropertyDescriptor parent) : base(parent) { 9 | _parent = parent; 10 | } 11 | 12 | public override void AddValueChanged(object component, EventHandler handler) { 13 | _parent.AddValueChanged(component, handler); 14 | } 15 | 16 | public override bool CanResetValue(object component) { 17 | return _parent.CanResetValue(component); 18 | } 19 | 20 | public override PropertyDescriptorCollection GetChildProperties(object instance, Attribute[] filter) { 21 | return _parent.GetChildProperties(instance, filter); 22 | } 23 | 24 | public override object GetEditor(Type editorBaseType) { 25 | return _parent.GetEditor(editorBaseType); 26 | } 27 | 28 | public override object GetValue(object component) { 29 | return _parent.GetValue(component); 30 | } 31 | 32 | public override void RemoveValueChanged(object component, EventHandler handler) { 33 | _parent.RemoveValueChanged(component, handler); 34 | } 35 | 36 | public override void ResetValue(object component) { 37 | _parent.ResetValue(component); 38 | } 39 | 40 | public override void SetValue(object component, object value) { 41 | _parent.SetValue(component, value); 42 | } 43 | 44 | public override bool ShouldSerializeValue(object component) { 45 | return _parent.ShouldSerializeValue(component); 46 | } 47 | 48 | public override Type ComponentType { 49 | get { return _parent.ComponentType; } 50 | } 51 | 52 | public override TypeConverter Converter { 53 | get { return _parent.Converter; } 54 | } 55 | 56 | public override bool IsLocalizable { 57 | get { return _parent.IsLocalizable; } 58 | } 59 | 60 | public override bool IsReadOnly { 61 | get { return _parent.IsReadOnly; } 62 | } 63 | 64 | public override Type PropertyType { 65 | get { return _parent.PropertyType; } 66 | } 67 | 68 | public override bool SupportsChangeEvents { 69 | get { return _parent.SupportsChangeEvents; } 70 | } 71 | 72 | public override string DisplayName { 73 | get { return _parent.DisplayName; } 74 | } 75 | 76 | public override bool DesignTimeOnly { 77 | get { return _parent.DesignTimeOnly; } 78 | } 79 | 80 | public override string Name { 81 | get { return _parent.Name; } 82 | } 83 | 84 | public override bool IsBrowsable { 85 | get { return _parent.IsBrowsable; } 86 | } 87 | 88 | public override string Description { 89 | get { return _parent.Description; } 90 | } 91 | 92 | public override string Category { 93 | get { return _parent.Category; } 94 | } 95 | 96 | public override AttributeCollection Attributes { 97 | get { return _parent.Attributes; } 98 | } 99 | } 100 | } -------------------------------------------------------------------------------- /ExceptionBreaker/Options/ImprovedComponentModel/ImprovedTypeDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | 5 | namespace ExceptionBreaker.Options.ImprovedComponentModel { 6 | public class ImprovedTypeDescriptor : CustomTypeDescriptor { 7 | public ImprovedTypeDescriptor(ICustomTypeDescriptor parent) : base(parent) { 8 | } 9 | 10 | public override PropertyDescriptorCollection GetProperties() { 11 | return ProcessProperties(base.GetProperties()); 12 | } 13 | 14 | public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) { 15 | return ProcessProperties(base.GetProperties(attributes)); 16 | } 17 | 18 | private static PropertyDescriptorCollection ProcessProperties(PropertyDescriptorCollection properties) { 19 | var newList = new List(); 20 | foreach (PropertyDescriptor property in properties) { 21 | var descriptorAttribute = (PropertyDescriptorAttribute)property.Attributes[typeof(PropertyDescriptorAttribute)]; 22 | if (descriptorAttribute != null) { 23 | var newProperty = (PropertyDescriptor)Activator.CreateInstance(descriptorAttribute.PropertyDescriptorType, new[] { property }); 24 | newList.Add(newProperty); 25 | continue; 26 | } 27 | newList.Add(property); 28 | } 29 | return new PropertyDescriptorCollection(newList.ToArray()); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /ExceptionBreaker/Options/ImprovedComponentModel/ImprovedTypeDescriptorProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | 5 | namespace ExceptionBreaker.Options.ImprovedComponentModel { 6 | public class ImprovedTypeDescriptorProvider : TypeDescriptionProvider { 7 | public ImprovedTypeDescriptorProvider(TypeDescriptionProvider parent) : base(parent) { 8 | } 9 | 10 | public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) { 11 | return new ImprovedTypeDescriptor(base.GetTypeDescriptor(objectType, instance)); 12 | } 13 | 14 | public static void RegisterFor(Type type) { 15 | var provider = TypeDescriptor.GetProvider(type); 16 | if (provider is ImprovedTypeDescriptorProvider) 17 | return; 18 | 19 | TypeDescriptor.AddProvider(new ImprovedTypeDescriptorProvider(provider), type); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ExceptionBreaker/Options/ImprovedComponentModel/PropertyDescriptorAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace ExceptionBreaker.Options.ImprovedComponentModel { 5 | public class PropertyDescriptorAttribute : Attribute { 6 | public Type PropertyDescriptorType { get; private set; } 7 | 8 | public PropertyDescriptorAttribute(Type propertyDescriptorType) { 9 | PropertyDescriptorType = propertyDescriptorType; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ExceptionBreaker/Options/OptionsPageData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Text.RegularExpressions; 5 | using System.Windows; 6 | using AshMind.Extensions; 7 | using ExceptionBreaker.Implementation; 8 | using ExceptionBreaker.Options.ImprovedComponentModel; 9 | using ExceptionBreaker.Options.Support; 10 | using Microsoft.Forums.WpfDialogPageIntegration; 11 | using Microsoft.VisualStudio.Shell; 12 | 13 | namespace ExceptionBreaker.Options { 14 | public class OptionsPageData : UIElementDialogPage { 15 | private readonly Lazy _exceptionListProvider; 16 | private readonly Lazy _logger; 17 | 18 | static OptionsPageData() { 19 | ImprovedTypeDescriptorProvider.RegisterFor(typeof(OptionsPageData)); 20 | } 21 | 22 | public OptionsPageData() : this( 23 | new Lazy(() => ExceptionBreakerPackage.Current.ExceptionBreakManager), 24 | new Lazy(() => ExceptionBreakerPackage.Current.Logger) 25 | ) {} 26 | 27 | public OptionsPageData(Lazy exceptionListProvider, Lazy logger) { 28 | _exceptionListProvider = exceptionListProvider; 29 | _logger = logger; 30 | Ignored = new List(); 31 | } 32 | 33 | [TypeConverter(typeof(FailSafeJsonTypeConverter))] 34 | [PropertyDescriptor(typeof(ProperListPropertyDescriptor))] 35 | public IList Ignored { get; private set; } 36 | 37 | protected override UIElement Child { 38 | get { return CreateChild(); } 39 | } 40 | 41 | private UIElement CreateChild() { 42 | var manager = _exceptionListProvider.Value; 43 | var exceptionNamesObservable = new ObservableValue>(manager.GetExceptionNames()); 44 | _exceptionListProvider.Value.ExceptionNamesChanged += delegate { 45 | var count = 0; 46 | exceptionNamesObservable.Value = manager.GetExceptionNames() 47 | .OnAfterEach(_ => count += 1) 48 | .OnAfterLast(_ => _logger.Value.WriteLine("Options: Found {0} exceptions for preview.", count)); 49 | }; 50 | 51 | return new OptionsPageView { 52 | Model = new OptionsViewModel(this, exceptionNamesObservable) 53 | }; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /ExceptionBreaker/Options/OptionsPageView.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | This is a new feature, so it might not be perfectly reliable. Please 25 | report any issues. 26 | 27 | 28 | 29 | 30 | 36 | 37 | 46 | 47 | 48 | 53 | 59 | 60 | 61 | 62 | 63 | 78 | 79 | 80 | 81 | 85 | 86 | 87 | 88 | 89 | 90 | 94 | 98 | 99 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | Matching exceptions (preview, might not represent the full list): 123 | 124 | 125 | 126 | 127 | Preview is not available. This might happen if there is no open solution. 128 | 129 | 130 | No exceptions match any of the above patterns. 131 | 132 | 133 | 134 | 135 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | -------------------------------------------------------------------------------- /ExceptionBreaker/Options/OptionsPageView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | using System.Windows.Data; 6 | using Microsoft.VisualStudio.PlatformUI; 7 | 8 | namespace ExceptionBreaker.Options { 9 | // This is not 'proper' WPF -- but I find it hard to spend any more 10 | // time remembering WPF when I am planning to avoid using it wherever 11 | // possible. 12 | public partial class OptionsPageView : UserControl { 13 | public OptionsPageView() { 14 | InitializeComponent(); 15 | } 16 | 17 | public OptionsViewModel Model { 18 | get { return (OptionsViewModel)DataContext; } 19 | set { DataContext = value; } 20 | } 21 | 22 | private void textPattern_OnGotFocus(object sender, RoutedEventArgs e) { 23 | var item = ((UIElement)sender).FindAncestor(); 24 | item.IsSelected = true; 25 | } 26 | 27 | private void buttonAdd_Click(object sender, RoutedEventArgs e) { 28 | Model.IgnoredPatterns.AddNew(); 29 | } 30 | 31 | private void buttonDelete_Click(object sender, RoutedEventArgs e) { 32 | Model.IgnoredPatterns.DeleteSelected(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ExceptionBreaker/Options/OptionsViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.ComponentModel; 5 | using System.Linq; 6 | using ExceptionBreaker.Options.Support; 7 | 8 | namespace ExceptionBreaker.Options { 9 | public class OptionsViewModel { 10 | private readonly OptionsPageData _data; 11 | private readonly ObservableCollection _exceptionsMatchingIgnored; 12 | 13 | public OptionsViewModel(OptionsPageData data, ObservableValue> exceptionNames) { 14 | _data = data; 15 | IgnoredPatterns = new PatternCollectionViewModel(data.Ignored); 16 | AllExceptions = exceptionNames.GetObservable(v => new ReadOnlyCollection( 17 | v.Select(n => new ExceptionViewModel(n, IgnoredPatterns.Selected)).ToArray() 18 | )); 19 | 20 | _exceptionsMatchingIgnored = new ObservableCollection(); 21 | ExceptionsMatchingIgnored = new ReadOnlyObservableCollection(_exceptionsMatchingIgnored); 22 | 23 | AllExceptions.ValueChanged += (sender, e) => RecalculateExceptionsMatchingIgnored(); 24 | 25 | IgnoredPatterns.Values.CollectionChanged += (sender, e) => RecalculateExceptionsMatchingIgnored(); 26 | var ignoredChangeHandler = (EventHandler) delegate { RecalculateExceptionsMatchingIgnored(); }; 27 | IgnoredPatterns.Values.AddHandlers( 28 | added => { 29 | added.Pattern.ValueChanged += ignoredChangeHandler; 30 | added.Enabled.ValueChanged += ignoredChangeHandler; 31 | }, 32 | removed => { 33 | removed.Pattern.ValueChanged -= ignoredChangeHandler; 34 | removed.Enabled.ValueChanged -= ignoredChangeHandler; 35 | } 36 | ); 37 | 38 | RecalculateExceptionsMatchingIgnored(); 39 | } 40 | 41 | private void RecalculateExceptionsMatchingIgnored() { 42 | AllExceptions.Value.SyncToWhere(_exceptionsMatchingIgnored, e => _data.Ignored.Any(p => p.Matches(e.Name))); 43 | } 44 | 45 | public PatternCollectionViewModel IgnoredPatterns { get; private set; } 46 | public IObservableResult> AllExceptions { get; private set; } 47 | public ReadOnlyObservableCollection ExceptionsMatchingIgnored { get; private set; } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /ExceptionBreaker/Options/PatternCollectionViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.ComponentModel; 5 | using System.Linq; 6 | using AshMind.Extensions; 7 | using ExceptionBreaker.Options.Support; 8 | 9 | namespace ExceptionBreaker.Options { 10 | public class PatternCollectionViewModel { 11 | private readonly ICollection _data; 12 | 13 | public PatternCollectionViewModel(ICollection data) { 14 | Argument.NotNull("data", data); 15 | _data = data; 16 | 17 | Values = new ObservableCollection(data.Select(d => new PatternViewModel(d))); 18 | SetupValues(); 19 | 20 | Selected = new ObservableValue(); 21 | 22 | CanAdd = Values.GetObservable(c => c.All(v => !v.IsEmpty.Value), (c, e, changed) => { 23 | var handler = (EventHandler)delegate { changed(); }; 24 | e.ProcessChanges( 25 | newItem => newItem.IsEmpty.ValueChanged += handler, 26 | oldItem => oldItem.IsEmpty.ValueChanged -= handler 27 | ); 28 | }); 29 | CanDelete = Selected.GetObservable(v => v != null); 30 | } 31 | 32 | private void SetupValues() { 33 | Values.CollectionChanged += (sender, e) => UpdateData(); 34 | var valuesChangedHandler = (EventHandler)delegate { UpdateData(); }; 35 | Values.AddHandlers( 36 | added => added.IsEmpty.ValueChanged += valuesChangedHandler, 37 | removed => removed.IsEmpty.ValueChanged -= valuesChangedHandler 38 | ); 39 | } 40 | 41 | private void UpdateData() { 42 | _data.Clear(); 43 | _data.AddRange(Values.Where(v => !v.IsEmpty.Value).Select(v => v.Data)); 44 | } 45 | 46 | public ObservableCollection Values { get; private set; } 47 | public IObservableResult CanAdd { get; private set; } 48 | public IObservableResult CanDelete { get; private set; } 49 | public ObservableValue Selected { get; private set; } 50 | 51 | public void AddNew() { 52 | Values.Add(new PatternViewModel("")); 53 | } 54 | 55 | public void DeleteSelected() { 56 | Values.Remove(Selected.Value); 57 | Selected.Value = null; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /ExceptionBreaker/Options/PatternData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace ExceptionBreaker.Options { 6 | public class PatternData { 7 | private Regex _regex; 8 | 9 | public PatternData(Regex regex) { 10 | Argument.NotNull("regex", regex); 11 | Regex = regex; 12 | Enabled = true; 13 | } 14 | 15 | public bool Enabled { get; set; } 16 | public Regex Regex { 17 | get { return _regex; } 18 | set { _regex = Argument.NotNull("value", value); } 19 | } 20 | 21 | public bool Matches(string name) { 22 | return Enabled && Regex.IsMatch(name); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ExceptionBreaker/Options/PatternViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Text.RegularExpressions; 2 | using System.Windows.Data; 3 | using ExceptionBreaker.Options.Support; 4 | 5 | namespace ExceptionBreaker.Options { 6 | public class PatternViewModel { 7 | public PatternViewModel(PatternData data) { 8 | Data = data; 9 | Pattern = new ObservableValue(data.Regex.ToString()); 10 | Enabled = new ObservableValue(data.Enabled); 11 | IsEmpty = Pattern.GetObservable(string.IsNullOrEmpty); 12 | 13 | Enabled.PropertyChanged += (sender, e) => { 14 | data.Enabled = ((ObservableValue)sender).Value; 15 | }; 16 | Pattern.PropertyChanged += (sender, e) => { 17 | var pattern = ((ObservableValue) sender).Value; 18 | if (string.IsNullOrEmpty(pattern)) 19 | return; 20 | 21 | data.Regex = new Regex(pattern); 22 | }; 23 | 24 | } 25 | 26 | public PatternViewModel(string pattern) : this(new PatternData(new Regex(pattern))) { 27 | } 28 | 29 | public PatternData Data { get; private set; } 30 | public ObservableValue Pattern { get; private set; } 31 | public ObservableValue Enabled { get; private set; } 32 | public IObservableResult IsEmpty { get; private set; } 33 | } 34 | } -------------------------------------------------------------------------------- /ExceptionBreaker/Options/ProvideOptionPageInExistingCategoryAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.Shell; 3 | 4 | namespace ExceptionBreaker.Options { 5 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] 6 | public class ProvideOptionPageInExistingCategoryAttribute : ProvideOptionDialogPageAttribute { 7 | private readonly string _categoryName; 8 | private readonly string _pageName; 9 | 10 | public string CategoryName { 11 | get { return _categoryName; } 12 | } 13 | 14 | public string PageName { 15 | get { return _pageName; } 16 | } 17 | 18 | private string GetPageRegKeyPath() { 19 | return string.Format(@"ToolsOptionsPages\{0}\{1}", CategoryName, PageName); 20 | } 21 | 22 | public ProvideOptionPageInExistingCategoryAttribute(Type pageType, string categoryName, string pageName, short pageNameResourceID) 23 | : base(pageType, "#" + pageNameResourceID) 24 | { 25 | if (categoryName == null) throw new ArgumentNullException("categoryName"); 26 | if (pageName == null) throw new ArgumentNullException("pageName"); 27 | 28 | _categoryName = categoryName; 29 | _pageName = pageName; 30 | } 31 | 32 | public override void Register(RegistrationContext context) { 33 | context.Log.WriteLine("Registering options page: {0}, {1}", CategoryName, PageName); 34 | using (var key = context.CreateKey(GetPageRegKeyPath())) { 35 | key.SetValue(string.Empty, PageNameResourceId); 36 | key.SetValue("Package", context.ComponentType.GUID.ToString("B")); 37 | key.SetValue("Page", PageType.GUID.ToString("B")); 38 | } 39 | } 40 | 41 | public override void Unregister(RegistrationContext context) { 42 | context.RemoveKey(GetPageRegKeyPath()); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /ExceptionBreaker/Options/RegexValidationRule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Text.RegularExpressions; 5 | using System.Windows.Controls; 6 | 7 | namespace ExceptionBreaker.Options { 8 | public class RegexValidationRule : ValidationRule { 9 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) { 10 | var @string = (string)value; 11 | try { 12 | new Regex(@string); 13 | } 14 | catch (ArgumentException ex) { 15 | // https://connect.microsoft.com/VisualStudio/feedback/details/331753/regex-should-have-a-static-tryparse-method 16 | return new ValidationResult(false, ex.Message); 17 | } 18 | return ValidationResult.ValidResult; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ExceptionBreaker/Options/Support/BindingDelay.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Windows; 5 | using System.Windows.Data; 6 | using System.Windows.Threading; 7 | 8 | namespace ExceptionBreaker.Options.Support { 9 | public class BindingDelay { 10 | private readonly DependencyProperty _property; 11 | private readonly DispatcherTimer _timer; 12 | private DependencyObject _target; 13 | private BindingExpression _bindingExpression; 14 | 15 | public BindingDelay(DependencyProperty property, TimeSpan delay) { 16 | _property = property; 17 | 18 | _timer = new DispatcherTimer(); 19 | _timer.Tick += Timer_Tick; 20 | _timer.Interval = delay; 21 | } 22 | 23 | private void Timer_Tick(object sender, EventArgs eventArgs) { 24 | _timer.Stop(); 25 | _bindingExpression.UpdateSource(); 26 | } 27 | 28 | private void Set(DependencyObject target) { 29 | var element = target as UIElement; 30 | if (element == null) { 31 | SetImmediate(target); 32 | return; 33 | } 34 | 35 | EventHandler handler = null; 36 | handler = ((sender, e) => { 37 | element.LayoutUpdated -= handler; 38 | SetImmediate(element); 39 | }); 40 | element.LayoutUpdated += handler; 41 | } 42 | 43 | private void SetImmediate(DependencyObject target) { 44 | _target = target; 45 | _bindingExpression = BindingOperations.GetBindingExpression(target, _property); 46 | if (_bindingExpression == null) 47 | throw new InvalidOperationException("Binding not found on " + target + " " + _property.Name + "."); 48 | 49 | if (_bindingExpression.ParentBinding.UpdateSourceTrigger != UpdateSourceTrigger.Explicit) 50 | throw new InvalidOperationException("Binding UpdateSourceTrigger must be set to Explicit."); 51 | 52 | var descriptor = DependencyPropertyDescriptor.FromProperty(_property, target.GetType()); 53 | descriptor.AddValueChanged(target, (sender, e) => { 54 | _timer.Stop(); 55 | _timer.Start(); 56 | }); 57 | } 58 | 59 | public static void SetList(DependencyObject target, ICollection delays) { 60 | foreach (var delay in delays) { 61 | delay.Set(target); 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /ExceptionBreaker/Options/Support/BindingDelayExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Markup; 7 | 8 | namespace ExceptionBreaker.Options.Support { 9 | public class BindingDelayExtension : MarkupExtension { 10 | public override object ProvideValue(IServiceProvider serviceProvider) { 11 | return new[] { new BindingDelay(Property, TimeSpan.FromMilliseconds(Delay)) }; 12 | } 13 | 14 | public DependencyProperty Property { get; set; } 15 | public int Delay { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ExceptionBreaker/Options/Support/CollectionSyncExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace ExceptionBreaker.Options.Support { 5 | public static class CollectionSyncExtensions { 6 | public static void SyncToWhere(this IList source, IList target, Func predicate) { 7 | var offset = 0; 8 | for (var i = 0; i < target.Count; i++) { 9 | var targetItem = target[i]; 10 | var shouldContinue = false; 11 | while (!Equals(source[i + offset], targetItem)) { 12 | var notPreviouslyMatched = source[i + offset]; 13 | if (predicate(notPreviouslyMatched)) { 14 | target.Insert(i, notPreviouslyMatched); 15 | shouldContinue = true; 16 | break; 17 | } 18 | 19 | offset += 1; 20 | } 21 | 22 | if (shouldContinue) 23 | continue; 24 | 25 | if (!predicate(targetItem)) { 26 | target.RemoveAt(i); 27 | i -= 1; 28 | offset += 1; 29 | } 30 | } 31 | 32 | for (var i = target.Count; i < source.Count - offset; i++) { 33 | var sourceItem = source[i + offset]; 34 | if (predicate(sourceItem)) 35 | target.Add(sourceItem); 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ExceptionBreaker/Options/Support/IObservableResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | 5 | namespace ExceptionBreaker.Options.Support { 6 | public interface IObservableResult : INotifyPropertyChanged { 7 | event EventHandler ValueChanged; 8 | T Value { get; } 9 | IObservableResult GetObservable(Func get, Action subscribeExtra = null); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ExceptionBreaker/Options/Support/ObservableCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Collections.Specialized; 5 | 6 | namespace ExceptionBreaker.Options.Support { 7 | public static class ObservableCollectionExtensions { 8 | public static IObservableResult GetObservable(this TCollection collection, Func get, Action subscribeExtra = null) 9 | where TCollection : INotifyCollectionChanged 10 | { 11 | subscribeExtra = subscribeExtra ?? ((c, e, a) => {}); 12 | var result = new ObservableValue(get(collection)); 13 | collection.CollectionChanged += (sender, e) => { 14 | result.Value = get(collection); 15 | subscribeExtra(collection, e, () => result.Value = get(collection)); 16 | }; 17 | 18 | return result; 19 | } 20 | 21 | public static void AddHandlers(this ObservableCollection collection, Action onAdded, Action onRemoved) { 22 | foreach (var item in collection) { 23 | onAdded(item); 24 | } 25 | collection.CollectionChanged += (sender, e) => e.ProcessChanges(onAdded, onRemoved); 26 | } 27 | 28 | public static void ProcessChanges(this NotifyCollectionChangedEventArgs e, Action processNew, Action processOld) { 29 | if (e.NewItems != null) { 30 | foreach (T item in e.NewItems) { 31 | processNew(item); 32 | } 33 | } 34 | 35 | if (e.OldItems != null) { 36 | foreach (T item in e.OldItems) { 37 | processOld(item); 38 | } 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ExceptionBreaker/Options/Support/ObservableValue.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | 4 | namespace ExceptionBreaker.Options.Support { 5 | public class ObservableValue : IObservableResult { 6 | public event PropertyChangedEventHandler PropertyChanged = delegate { }; 7 | public event EventHandler ValueChanged = delegate { }; 8 | private static readonly PropertyChangedEventArgs PropertyChangedEventArgs = new PropertyChangedEventArgs("Value"); 9 | 10 | private T _value; 11 | 12 | public ObservableValue() { 13 | } 14 | 15 | public ObservableValue(T value) { 16 | _value = value; 17 | } 18 | 19 | public T Value { 20 | get { return _value; } 21 | set { 22 | if (Equals(_value, value)) 23 | return; 24 | 25 | _value = value; 26 | PropertyChanged(this, PropertyChangedEventArgs); 27 | ValueChanged(this, EventArgs.Empty); 28 | } 29 | } 30 | 31 | public IObservableResult GetObservable(Func get, Action subscribeExtra = null) { 32 | var result = new ObservableValue(get(Value)); 33 | var lastValue = Value; 34 | PropertyChanged += (sender, _) => { 35 | var that = (ObservableValue)sender; 36 | result.Value = get(that.Value); 37 | if (subscribeExtra != null) 38 | subscribeExtra(that.Value, lastValue, () => result.Value = get(that.Value)); 39 | lastValue = Value; 40 | }; 41 | return result; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /ExceptionBreaker/Options/Support/ProperListPropertyDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using ExceptionBreaker.Options.ImprovedComponentModel; 6 | 7 | namespace ExceptionBreaker.Options.Support { 8 | public class ProperListPropertyDescriptor : CustomPropertyDescriptor { 9 | public ProperListPropertyDescriptor(PropertyDescriptor parent) : base(parent) { 10 | } 11 | 12 | public override bool IsReadOnly { 13 | get { return false; } 14 | } 15 | 16 | public override void SetValue(object component, object value) { 17 | var list = (IList)base.GetValue(component); 18 | var newList = (IEnumerable)value; 19 | 20 | list.Clear(); 21 | if (newList == null) 22 | return; 23 | 24 | foreach (var item in newList) { 25 | list.Add(item); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ExceptionBreaker/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Resources; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("ExceptionBreaker")] 10 | [assembly: AssemblyCompany("Andrey Shchekin")] 11 | [assembly: AssemblyProduct("ExceptionBreaker")] 12 | [assembly: AssemblyCopyright("(c) 2013 Andrey Shchekin")] 13 | [assembly: ComVisible(false)] 14 | [assembly: CLSCompliant(false)] 15 | [assembly: NeutralResourcesLanguage("en-US")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Revision and Build Numbers 25 | // by using the '*' as shown below: 26 | 27 | [assembly: AssemblyVersion("1.1.2")] 28 | [assembly: AssemblyFileVersion("1.1.2")] -------------------------------------------------------------------------------- /ExceptionBreaker/Resources/Add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashmind/ExceptionBreaker/c40a5ae6a83f671314306baeb68ad80653ab42c5/ExceptionBreaker/Resources/Add.png -------------------------------------------------------------------------------- /ExceptionBreaker/Resources/Commands.VS2010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashmind/ExceptionBreaker/c40a5ae6a83f671314306baeb68ad80653ab42c5/ExceptionBreaker/Resources/Commands.VS2010.png -------------------------------------------------------------------------------- /ExceptionBreaker/Resources/Commands.VS2012.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashmind/ExceptionBreaker/c40a5ae6a83f671314306baeb68ad80653ab42c5/ExceptionBreaker/Resources/Commands.VS2012.png -------------------------------------------------------------------------------- /ExceptionBreaker/Resources/Delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashmind/ExceptionBreaker/c40a5ae6a83f671314306baeb68ad80653ab42c5/ExceptionBreaker/Resources/Delete.png -------------------------------------------------------------------------------- /ExceptionBreaker/Resources/Package.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashmind/ExceptionBreaker/c40a5ae6a83f671314306baeb68ad80653ab42c5/ExceptionBreaker/Resources/Package.ico -------------------------------------------------------------------------------- /ExceptionBreaker/Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashmind/ExceptionBreaker/c40a5ae6a83f671314306baeb68ad80653ab42c5/ExceptionBreaker/Screenshot.png -------------------------------------------------------------------------------- /ExceptionBreaker/VSPackage.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Exception Breaker 122 | 123 | 124 | Simplifies "Break On Exception" UI. 125 | 126 | 127 | 128 | Resources\Package.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 129 | 130 | -------------------------------------------------------------------------------- /ExceptionBreaker/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ExceptionBreaker/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exception Breaker 5 | Andrey Shchekin 6 | 1.1.2 7 | ExceptionBreaker is a VS extension that provides a way to fast-toggle breaking on all CLR exceptions. 8 | It is available through both `Debug` toolbar and `Debug` top level menu. 9 | 1033 10 | http://github.com/ashmind/ExceptionBreaker 11 | Screenshot.png 12 | false 13 | 14 | 15 | Pro 16 | 17 | 18 | Pro 19 | 20 | 21 | Pro 22 | 23 | 24 | Pro 25 | 26 | 27 | 28 | 29 | 30 | 31 | Visual Studio MPF 32 | 33 | 34 | 35 | |%CurrentProject%;PkgdefProjectOutputGroup| 36 | 37 | 38 | -------------------------------------------------------------------------------- /nuget.config: -------------------------------------------------------------------------------- 1 | 2 | #packages 3 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ### Overview 2 | 3 | ExceptionBreaker is a VS extension that provides a way to fast-toggle breaking on all CLR exceptions. 4 | It is available through both `Debug` toolbar and `Debug` top level menu. 5 | 6 | ![](%23assets/screenshots/VS2012.Toolbar.png) 7 | 8 | ### Installation 9 | 10 | The extension can be installed from [Visual Studio Gallery](http://visualstudiogallery.msdn.microsoft.com/50091e25-9e75-40d3-9780-a05892f474de). 11 | Supported VS versions: 2010, 2012, 2013, 2015. 12 | 13 | ### Details 14 | 15 | Pressing the button sets (or unsets) breaking for all exceptions in `Common Language Runtime Exceptions` group: 16 | 17 |

18 | 19 | Notes: 20 | 21 | 1. If using `Just My Code`, both `Thrown` and `Unhandled` columns will be affected. 22 | (I do not use `Just My Code` so please let me know if deselecting `Unhandled` makes any sense). 23 | 24 | 2. Deselected button is not equal to "Do not break on all CLR exceptions". 25 | Some exceptions might be selected (manually through `Debug -> Exceptions`) — just not all of them. 26 | 27 | ### Options 28 | 29 | By popular demand, version 1.1 introduces support for excluding certain exceptions from being changed: 30 | 31 |

32 | 33 | ### Thanks 34 | 35 | This extension would not exist without the help of [Sam Harwell](http://stackoverflow.com/users/138304/280z28) of [Tunnel Vision Laboratories](http://tunnelvisionlabs.com/). 36 | --------------------------------------------------------------------------------