visual-studio-debugging

How to debug a WebMethod in ASP.NET

对着背影说爱祢 提交于 2019-12-06 07:40:35
I have the following WebMethod in my fileName.asmx.cs file. [WebMethod(EnableSession = true)] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public string GetData(string value) { //----- //Respective code querying the database //----- } Here is the respective ajax call using jQuery getData: function (type) { var response = ""; $.ajax({ type: "POST", dataType: 'json', url: "../GetData", data: '{value:' + type.toString() + '}', async: false, contentType: "application/json; charset=utf-8", success: function (msg) { console.log('succes', msg) response = msg; } }); return response.d; } I add

How to package and deploy a NuGet package with symbols and source code so that debugger can use THAT source code?

北城余情 提交于 2019-12-06 07:13:34
I have created a very simple NuGet package from a .net framework visual studio Class Library project, where the class library source is in C#. I used this command to create the nuget package: nuget pack MyProject.csproj -symbols -Properties "Configuration=Debug" -suffix debug Which creates, as I expect, two nuget package file, namely: MyProject.1.0.0-debug.symbols.nupkg MyProject.1.0.0-debug.nupkg These packages are basically identical other than that the one with "symbols" includes the pdb files in the lib hierarchy and source files in the src folder. Given the duplication, I rename the file

Debug .NET Core source (Visual Studio 2019)

戏子无情 提交于 2019-12-06 06:15:00
I use Visual Studio 2019 and .NET Core 3 web application. I'd like to debug .NET Core source code, so when an error occurs I can dive into the code and examine it in more detail. As I couldn't find an exact description on how to do it (even on Microsoft documentation site), I'll try to summarize here what I know so far. I have the following options in Visual Studio: Enable just my code Enable .NET framework source stepping Enable source server support Enable source link support The first two options are mutually exclusive. I suppose I should select the second option, although I don't

Is there a way to print an Armadillo matrix or vector in Visual Studio Debug?

人盡茶涼 提交于 2019-12-06 05:56:25
问题 I'm wondering whether there is any method to show vector/matrix entries values in the debugging section on Visual Studio (in particular VS2012). This question is very similar to the one posted in: Is there a way to print an Armadillo matrix in gdb? however I did not manage to figure out whether this approach also applies to VS. Thanks. 回答1: This .natvis XML code works fine in visual studio 2013. I added @Claes Rolen XML in visual studio 2013 and that dose not work fine for me. The trick is to

Can I get Visual Studio to ignore a specific *instance* of an exception?

孤街醉人 提交于 2019-12-06 04:35:55
I am working with 3rd-party code that throws and catches a NullReferenceException as part of its ordinary, correct operation. I would like to be able to tell Visual Studio to ignore this instance (ie, ignore NullReferenceException s thrown from this .cs file + line number) but continue to break on other thrown NullReferenceException s. Is this possible? edit: By 3rd party code I mean source code that is part of the project, but that I don't own and won't be modifying. I can't use anything that relies on VS's definition of user code , for example, because this also counts as user code . The

How is this causing an endless loop?

若如初见. 提交于 2019-12-06 03:57:16
问题 Some legacy code I'm stuck maintaining is stuck in an infinite loop (and thus I myself seem to be in one); I can't figure out why/how, though. Here's the app's entry point, where it instantiates the main form (frmCentral): CODE EXHIBIT A public static int Main(string [] args) { try { AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.UnhandledException += new UnhandledExceptionEventHandler(GlobalExceptionHandler); string name = Assembly.GetExecutingAssembly().GetName().Name;

Tracking Time Spent in Debugger

亡梦爱人 提交于 2019-12-06 03:37:50
问题 [ [ EDIT 2x ] I think I have worded my original question wrong, so I have scooted it down below and rewrote exactly what I am trying to get at, for future readers. ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [ New, Shiny, Clear Question with Better Wording ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I have a loop that is running for a simulation / gaming framework. This loop has several places in it where it needs to ascertain how much time - in reality - has passed, so that

Cannot attach the file as database / The underlying provider failed on Open

拈花ヽ惹草 提交于 2019-12-06 03:19:20
问题 I have an MVC3 application using the Entity Framework. I haven't used this application in about a year. Recently, I opened it up on a new PC and tried to run in debug mode and hit the following exception/stack trace in debug. The main exceptions seem to be "Cannot attach the file as database" and "The underlying provider failed on Open". I searched for these errors on stack overflow and the answers I found don't seem to match this situation. For example, one of the answers for "Cannot attach

Visual Studio 2015 Debugger Corruption - Is it a bug or just me?

[亡魂溺海] 提交于 2019-12-06 01:38:51
问题 Have I gone mad? I've always been able to trust the debugger right? Turns out that during a debugging session with VS2015, when I for example change the value of a variable in the Immediate Window, then that assignment results in a "garbage" value being assigned. It's the same garbage value every time, but completely wrong nonetheless. I've distilled this down to the simplest console application repro, and just in case you might think to concur with my self-assessment of madness, I've also

How to prevent the debugger from calling some source code when paused?

☆樱花仙子☆ 提交于 2019-12-05 22:51:31
In visual studio, when an application is stopped during debug mode you can hover over an object/property to see whats inside of it. When you open up an object using the debugger like I did with the above picture, the property has it's Get method called as a way for the debugger to retrieve the value of the property to show the user. class Program { static void Main(string[] args) { Foo foo = new Foo(); foo.MyLock.EnterWriteLock(); foo.Bar = 5.1; foo.MyLock.ExitWriteLock(); // "I stop here and attempt to see what the value of Bar is via the debugger." foo.MyLock.EnterReadLock(); Console