Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
294 changes: 294 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,294 @@
# NOTE: Requires **VS2019 16.3** or later

# Rules for JustMyCodeToggle
# Description: Code analysis rules for JustMyCodeToggle.
# top-most EditorConfig file
root = true

[*]
charset = utf-8
end_of_line = crlf
indent_style = space
indent_size = 4
tab_width = 4
insert_final_newline = true

# C# files
[*.cs]
# Organize using directives
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false
# VSEXTPREVIEW_SETTINGS: Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
dotnet_diagnostic.VSEXTPREVIEW_SETTINGS.severity = none



# Code style defaults
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true

# Naming conventions
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.camel_case_underscore.capitalization = camel_case
dotnet_naming_style.camel_case_underscore.required_prefix = _

dotnet_naming_rule.public_members_pascal_case.symbols = public_members
dotnet_naming_rule.public_members_pascal_case.style = pascal_case
dotnet_naming_rule.public_members_pascal_case.severity = suggestion

dotnet_naming_rule.private_fields_camel_case_underscore.symbols = private_fields
dotnet_naming_rule.private_fields_camel_case_underscore.style = camel_case_underscore
dotnet_naming_rule.private_fields_camel_case_underscore.severity = suggestion
csharp_indent_labels = no_change
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:silent
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_prefer_method_group_conversion = true:suggestion
csharp_style_prefer_top_level_statements = true:silent
csharp_style_prefer_primary_constructors = true:suggestion
csharp_prefer_system_threading_lock = true:suggestion
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_space_around_binary_operators = before_and_after
csharp_style_throw_expression = true:suggestion
csharp_style_prefer_null_check_over_type_check = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_local_over_anonymous_function = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_prefer_tuple_swap = true:suggestion
csharp_prefer_static_anonymous_function = true:suggestion
csharp_prefer_static_local_function = true:suggestion
csharp_style_prefer_readonly_struct_member = true:suggestion
csharp_style_prefer_readonly_struct = true:suggestion
csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
csharp_style_conditional_delegate_call = true:suggestion
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_prefer_pattern_matching = true:silent
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_var_elsewhere = false:silent
csharp_style_var_when_type_is_apparent = false:silent
csharp_style_var_for_built_in_types = false:silent
csharp_style_prefer_extended_property_pattern = true:suggestion
dotnet_diagnostic.CA1001.severity = warning

dotnet_diagnostic.CA1009.severity = warning

dotnet_diagnostic.CA1016.severity = warning

dotnet_diagnostic.CA1033.severity = warning

dotnet_diagnostic.CA1049.severity = warning

dotnet_diagnostic.CA1060.severity = warning

dotnet_diagnostic.CA1061.severity = warning

dotnet_diagnostic.CA1063.severity = warning

dotnet_diagnostic.CA1065.severity = warning

dotnet_diagnostic.CA1301.severity = warning

dotnet_diagnostic.CA1400.severity = warning

dotnet_diagnostic.CA1401.severity = warning

dotnet_diagnostic.CA1403.severity = warning

dotnet_diagnostic.CA1404.severity = warning

dotnet_diagnostic.CA1405.severity = warning

dotnet_diagnostic.CA1410.severity = warning

dotnet_diagnostic.CA1415.severity = warning

dotnet_diagnostic.CA1821.severity = warning

dotnet_diagnostic.CA1900.severity = warning

dotnet_diagnostic.CA1901.severity = warning

dotnet_diagnostic.CA2002.severity = warning

dotnet_diagnostic.CA2100.severity = warning

dotnet_diagnostic.CA2101.severity = warning

dotnet_diagnostic.CA2108.severity = warning

dotnet_diagnostic.CA2111.severity = warning

dotnet_diagnostic.CA2112.severity = warning

dotnet_diagnostic.CA2114.severity = warning

dotnet_diagnostic.CA2116.severity = warning

dotnet_diagnostic.CA2117.severity = warning

dotnet_diagnostic.CA2122.severity = warning

dotnet_diagnostic.CA2123.severity = warning

dotnet_diagnostic.CA2124.severity = warning

dotnet_diagnostic.CA2126.severity = warning

dotnet_diagnostic.CA2131.severity = warning

dotnet_diagnostic.CA2132.severity = warning

dotnet_diagnostic.CA2133.severity = warning

dotnet_diagnostic.CA2134.severity = warning

dotnet_diagnostic.CA2137.severity = warning

dotnet_diagnostic.CA2138.severity = warning

dotnet_diagnostic.CA2140.severity = warning

dotnet_diagnostic.CA2141.severity = warning

dotnet_diagnostic.CA2146.severity = warning

dotnet_diagnostic.CA2147.severity = warning

dotnet_diagnostic.CA2149.severity = warning

dotnet_diagnostic.CA2200.severity = warning

dotnet_diagnostic.CA2202.severity = warning

dotnet_diagnostic.CA2207.severity = warning

dotnet_diagnostic.CA2212.severity = warning

dotnet_diagnostic.CA2213.severity = warning

dotnet_diagnostic.CA2214.severity = warning

dotnet_diagnostic.CA2216.severity = warning

dotnet_diagnostic.CA2220.severity = warning

dotnet_diagnostic.CA2229.severity = warning

dotnet_diagnostic.CA2231.severity = warning

dotnet_diagnostic.CA2232.severity = warning

dotnet_diagnostic.CA2235.severity = warning

dotnet_diagnostic.CA2236.severity = warning

dotnet_diagnostic.CA2237.severity = warning

dotnet_diagnostic.CA2238.severity = warning

dotnet_diagnostic.CA2240.severity = warning

dotnet_diagnostic.CA2241.severity = warning

dotnet_diagnostic.CA2242.severity = warning

dotnet_diagnostic.CS1573.severity = silent

dotnet_diagnostic.CS1591.severity = silent

dotnet_diagnostic.CS1712.severity = silent

# IDE0003 duplicates functionality provided by SX1101
dotnet_diagnostic.IDE0003.severity = none

dotnet_diagnostic.SA1101.severity = none

# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2275
dotnet_diagnostic.SA1139.severity = none

dotnet_diagnostic.SA1202.severity = none

dotnet_diagnostic.SA1204.severity = none

dotnet_diagnostic.SA1309.severity = none

dotnet_diagnostic.SA1412.severity = warning

dotnet_diagnostic.SA1600.severity = none

dotnet_diagnostic.SA1601.severity = none

dotnet_diagnostic.SA1602.severity = none

dotnet_diagnostic.SA1611.severity = none

dotnet_diagnostic.SA1615.severity = none

dotnet_diagnostic.SX1101.severity = warning

dotnet_diagnostic.SX1309.severity = warning

dotnet_diagnostic.SX1309S.severity = warning
# VSTHRD200: Use "Async" suffix for async methods
dotnet_diagnostic.VSTHRD200.severity = none
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
dotnet_style_namespace_match_folder = true:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_readonly_field = true:suggestion
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
dotnet_style_predefined_type_for_member_access = true:silent
dotnet_style_allow_multiple_blank_lines_experimental = true:silent
dotnet_style_allow_statement_immediately_after_block_experimental = true:silent
dotnet_code_quality_unused_parameters = all:suggestion
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
dotnet_style_qualification_for_event = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_qualification_for_field = false:silent


[*.vsct]
indent_style = space
indent_size = 2

18 changes: 7 additions & 11 deletions JustMyCodeToggle.sln
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.12
MinimumVisualStudioVersion = 15.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{05CB4485-3F59-4189-96D8-F046221EC9CE}"
# Visual Studio Version 18
VisualStudioVersion = 18.0.11123.170 d18.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tvl.VisualStudio.JustMyCodeToggle", "Tvl.VisualStudio.JustMyCodeToggle\Tvl.VisualStudio.JustMyCodeToggle.csproj", "{10CAD392-E083-41EB-92C9-B5F3142FA9F8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
ProjectSection(SolutionItems) = preProject
.gitattributes = .gitattributes
.gitignore = .gitignore
appveyor.yml = appveyor.yml
LICENSE.txt = LICENSE.txt
README.md = README.md
.editorconfig = .editorconfig
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tvl.VisualStudio.JustMyCodeToggle", "Tvl.VisualStudio.JustMyCodeToggle\Tvl.VisualStudio.JustMyCodeToggle.csproj", "{10CAD392-E083-41EB-92C9-B5F3142FA9F8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
42 changes: 38 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,51 @@
# Just My Code Toggle extension for Visual Studio 2015+
# Just My Code Toggle extension for Visual Studio 2015->2026+

[![Build status](https://ci.appveyor.com/api/projects/status/dnxhxa3chg1dtpnt/branch/master?svg=true)](https://ci.appveyor.com/project/sharwell/justmycodetoggle/branch/master)
This primary goal of this extension is to add the **Debug.JustMyCodeToggle** from the options menu to the Visual Studio main window. By default, the command appears in the **Debug** toolbar as well as in the context menu for the **Call Stack** window. It also adds a few other setting commands in the toolbar using a split-button to toggle: Native Code Debugging, All Symbols / Selective Symbol loading, Disable .NET and JIT code optimization for external code or release builds for better preservation of variables/stack items normally optimized away.

This extension adds the **Debug.JustMyCodeToggle** command to Visual Studio. By default, the command appears in the **Debug** toolbar as well as in the context menu for the **Call Stack** window.
JustMyCode toggle can be changed while debugging but the others will only take effect on the next debug session.

### Debug Toolbar

![Debug Toolbar](doc/toolbar.png)
The toolbar also features a few other toggles including:
- Native Code Debugging - The debug properties debug native code option (stored in the .csproj.user file)
- All Module Symbol Loading - Toggle between VS trying to only load symbols for needed files/modules or loading for all modules ( this is the Options->Debugging->Symbols "Automatic searching symbols" dropdown )
- Disabling native / managed code optimization - Better debugging for native/3rd party code to preserve stack and variables (Only for new CPS style projects with launch profile support, as we need to set env vars). Env vars are stored in the launch profile but are deleted when you toggle this back off. This is similar to / slightly more robust than the Debugging-> use of precompiled images (which I couldn't find).


### Call Stack Window

![Call Stack window context menu](doc/callstack.png)

### Keyboard

By default, the new command is not bound to a keystroke. A key binding may be added manually by configuring a binding for the **Debug.JustMyCodeToggle** command.
By default, the new command is not bound to a keystroke. A key binding may be added manually by configuring a binding for any of the following commands:
- Debug.JustMyCodeToggle
- Debug.JMCSymbolLocalToggle
- Debug.JMCNativeCodeDebugging
- Debug.JMCDisableJitOptmizations


### VS 2026 Issues
VS 2026 once again has changed things so the 2022 tricks don't all work. It has largely been fixed except for "All Module Symbol Loading" for now in 2026 it will just open the options page to this, until some bugs in Extensibility are fixed. If you know of a way let me know:)


### Implementation
#### Commands
To simplify commands they are broken into two parts, command "setters" that handle getting/setting values using a certain manager (backend) and a base command helper. Due to the fact we partially support new Extensibility extension sdk there is a bit of oddity to be able to not duplicate code between the old OurOLEButton and our new OurExtensibilityToggleButton.


#### Managers
Managers are the different ways these things can be controlled in VS. We have:
- DebuggerServiceManager - Uses Debugger5 primarily was the attempt to do `debugger.SetSymbolSettings` to handle setting the module loading but it doesn't seem to actually work (no error just no change).
- DteManager - This uses dte.Properties to set options. This is kind of like a UI interaction interface. Note there is no documentation of the actual property categories/pages that exist but the manager has `DumpAllSettings` that contains as many as I have found.
- ExtensibilitySettingManager - The new unified settings backend. This is pretty sleek new system unfortunately getting the Extensibility service is broken right now. It does work if called from the extension menu. It has the ability to auto watch for external changes too.
- LaunchProfileManager - For modifying launch profiles of projects directly
- ProjectEventHandler - Generates reference events for us for things like project/solution changes so we can update current state
- SettingsStoreManager - For the VS Settings store (roaming,user,etc). While some settings appear here often changing things may not change the actual setting in VS (esp in 2026).
- StartupProjectManager - Checks if the startup project has changed and allows accessing the startup projet

#### Entry Points
As the script is a hybrid old style and new extensibility extension it has two entry points:
- ExtensibilityExtensionEntrypoint - Extensibility entrypoint we cant call any extensibility code until here. Unfortunately this is only called once an extensibility command is clicked as it is lazy inited.
- JustMyCodeTogglePackage - The traditional entry point for VSSDK plugins, called shortly after load.
Loading