How to get non-current thread’s stacktrace?

NB: Skip to the bottom of this answer for an update. Here’s what’s worked for me so far: StackTrace GetStackTrace (Thread targetThread) { StackTrace stackTrace = null; var ready = new ManualResetEventSlim(); new Thread (() => { // Backstop to release thread in case of deadlock: ready.Set(); Thread.Sleep (200); try { targetThread.Resume(); } catch { … Read more

Visual Studio 2017 Debug Error: To prevent an unsafe abort when evaluating the function *.toString all threads were allowed to run

I add the same error message but with a different function name : To prevent an unsafe abort when evaluating the function ‘Microsoft.VisualStudio.Debugger.Runtime.Tracing.Refresh’ all threads were allowed to run. This may have changed the state of the process and any breakpoints encountered have been skipped. This is how I got rid of this pesky bug … Read more

How to configure ASP.NET Core 1.0 to use Local IIS instead of IIS Express?

You currently cannot directly use IIS to host an ASP.NET Core application while developing, as the development folder does not provide all of the necessary files IIS needs to host. This makes running an ASP.NET Core in a development environment a bit of a pain. As pointed out in this article by Rick Strahl, there … Read more

Attaching to a child process automatically in Visual Studio during Debugging

I would use a macro. I’ve redefined my F5 function to attach to the asp.net process instead of the long build/validate it usually performs. This works pretty well for me and it’s really easy. For Each process In DTE.Debugger.LocalProcesses If (process.Name.IndexOf(“aspnet_wp.exe”) <> -1) Then process.Attach() Exit Sub End If Next

Can’t get VSCode/Python debugger to find my project modules

A simple workaround to the bug mentioned by @BrettCannon is to add the following env entry to the launch.json configuration: { “version”: “0.2.0”, “configurations”: [ { “name”: “Python: Current File”, “type”: “python”, “request”: “launch”, “program”: “${file}”, “console”: “integratedTerminal”, “env”: { “PYTHONPATH”: “${workspaceRoot}”} } ] }

Visual Studio 2013 can’t debug javascript in cshtml

So, apparently this is a “known issue” that will be fixed as soon as possible. A temporary work around that works for “some” people is making sure any Javascript is in a separate file. It is caused by having RAZR and Javascript in the same file and Visual Studio 2013 not being able to handle … Read more

VS2012 Breakpoints are not getting hit

Some ideas. Make sure it’s a debug build and not release Turn off optimizations in your project properties if they are on Try inserting Debugger.Break() in your code instead of a breakpoint in VS Make sure breakpoints are enabled (Debug->Windows->Breakpoints toolbar), and breakpoint symbol should be solid Execute your application. Load Debug->Window->Modules window. Check your … Read more

ASP.NET MVC5/IIS Express unable to debug – Code Not Running

For me the solution was a much simpler one. In my Solution Explorer in Visual Studio, I right click on the web project, chose properties and then navigated to the “web” tab. From there I changed the Project URL to another port number. For example, if it was http://localhost:1052 – I changed it to http://localhost:4356. … Read more

How to debug class library that called from external app?

Yes, you can do this with Visual Studio. You have two options: Configure your project to start the external program Open your DLL project. On the properties for the project, go to the Debug tab. Choose Start external program and give the path of the external program that will call your DLL, along with any … Read more