I read in chat gpt that there is a way to exclude certain DLLs from being debugged in VS 2022 - doing something like a startup file to mention / list all files which should not be debugged when attaching VS debugger to NinjaTrader (else it would crash ninjatrader). Do you have a step by step guide on how to accomplish it?
For example, I have 3rd party DLL with debugger protection, and I don't want VS to step into that file since I really want to debug my own source code - but NT8 crashes right away when trying to attach debugger. Any suggestions step by step on how to accomplish it?
This sample is more related to VSCode than Visual Studio...
VisualStudio should have files with .navstepfilter placed either into solution or into "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Packages\Debugger\Vi sualizers"
example for navstepfilter for vs 2022 C# to avoid debugging dll
Visual Studio 2022 offers step filtering for C# debugging to avoid stepping into unwanted DLLs. While the
.natstepfilter file is primarily for C++, you can achieve similar results in C# by leveraging the launch.json file and its skipFiles property.
Using launch.json and skipFiles for C#:
The launch.json file allows you to customize your debug configuration, including specifying which files or patterns to skip while debugging.
Example launch.json:
Here's an example of a launch.json file demonstrating how to use the skipFiles setting to avoid debugging a specific DLL:
json{
"version": "0.2.0",
"configurations": [
{
"name": "My C# App", // Replace with your application's name
"type": "dotnet",
"request": "launch",
"project": "${workspaceFolder}/YourApp.csproj", // Replace with your project file
"skipFiles": [
"${workspaceFolder}/path/to/your/dll/**/*.cs" // Replace with the actual path to your DLL
]
}
]
}
Use code with caution.
Explanation:
- skipFiles: This property accepts an array of strings that specify the files or patterns to skip during debugging.
- ${workspaceFolder}/path/to/your/dll/**/*.cs: This is a glob pattern that tells the debugger to skip all C# files (.cs) within the specified path to your DLL.
- Locate or Create launch.json: If you don't have a .vscode folder with a launch.json file in your project, you can create one.
- Add a Debug Configuration: Add or modify a debug configuration for your C# application within the launch.json file.
- Specify the DLL path in skipFiles: Configure the skipFiles setting with the correct path to the DLL that you want to avoid debugging.
- Start Debugging: Launch your application with the debugger attached.
Thank you

Comment