visual-studio-debugging

How do I start a program with arguments when debugging?

六眼飞鱼酱① 提交于 2019-11-27 10:03:41
问题 I want to debug a program in Visual Studio 2008. The problem is that it exits if it doesn't get arguments. This is from the main method: if (args == null || args.Length != 2 || args[0].ToUpper().Trim() != "RM") { Console.WriteLine("RM must be executed by the RSM."); Console.WriteLine("Press any key to exit program..."); Console.Read(); Environment.Exit(-1); } I don't want to comment it out and and then back in when compiling. How can I start the program with arguments when debugging? It is

Debugger not breaking/stopping for exceptions in async method

a 夏天 提交于 2019-11-27 09:56:31
问题 When a debugger is attached to a .NET process, it (usually) stops when an unhandled exception is thrown. However, this doesn't seem to work when you're in an async method. The scenarios I've tried before are listed in the following code: class Program { static void Main() { // Debugger stopps correctly Task.Run(() => SyncOp()); // Debugger doesn't stop Task.Run(async () => SyncOp()); // Debugger doesn't stop Task.Run((Func<Task>)AsyncTaskOp); // Debugger stops on "Wait()" with

How do I debug .NET 4.6 framework source code in Visual Studio 2017?

爱⌒轻易说出口 提交于 2019-11-27 08:04:05
Here's what I've tried: Made a new Console App (.NET Framework) in Visual Studio 2017. Added the following code: static void Main(string[] args) { new Dictionary<int, int>().TryGetValue(3, out int x); //I want to step into TryGetValue() (this is just an example) } Configured the settings listed here: https://blogs.msdn.microsoft.com/sburke/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code/ Confirmed symbols are loaded in the Modules window: mscorlib.dll Symbols loaded. 4.6.1586.0 built by: NETFXREL2 Tried: "Step Into (F11)" Tried: "Step into Specific" | "System

Visual Studio 2015 RTM - Debugging not working

99封情书 提交于 2019-11-27 06:26:46
I have installed VS 2015 RTM (nothing else) and I'm unable to debug any solution, not matter if it's an existing one or a brand new one (created with VS 2015 and compiled against .Net Framework 4.6), it only opens a new tab in VS which is called Break Mode with the following text: The application is in break mode Your app has entered a break state, but no code is executing that is supported by the selected debug engine (for e.g. only native runtime code is executing). And if I check the Debug --> Module Window: VS2015Test.vshost.exe no symbols loaded (even if I click load symbol it does not

Visual Studio during Debugging: The function evaluation requires all threads to run

爷,独闯天下 提交于 2019-11-27 03:42:41
问题 I'm getting suddenly a strange error while debugging. Up to now the variable in the watch windows has been shown correctly. Now I am getting always the error message in the watch windows: The function evaluation requires all threads to run I am not able to check any variable anymore. I am not explicit working with threads. What can I do to get it working again? I disabled already as mentioned in some forums the function: "Enable property Evaluation and other implicit function Calls" in the

Get “Internal error in the expression evaluator” on “Add watch” function when trying to debug WCF service code (MSVS 2013)

好久不见. 提交于 2019-11-27 02:55:06
Few days ago I moved my solution to MSVS 2013. It works fine except one thing: when I trying to debug code of my WCF service it works, but when I want to watch state of any variable it says: "Internal error in the expression evaluator". Add watch function works normal on client side, but in service code it broken. I'm trying to debug my own WCF service running on the localhost. Could you help me, how to repair this? Here MSVS info: Microsoft Visual Studio Professional 2013 Version 12.0.30110.00 Update 1 Microsoft .NET Framework Version 4.5.51641 OS: Windows 8.1 Igal Tabachnik This might be a

How to debug SQL Server T-SQL in Visual Studio 2012

大憨熊 提交于 2019-11-27 02:12:07
问题 How does one debug a T-SQL stored procedure in a multi-tier application in Visual Studio 2012? To be clear, I want to set a breakpoint in a sproc in VS 2012, and hit it when the sproc is called from an ASP.NET WebForms app in the same debugging session. When following the same steps as for VS 2010, the breakpoints aren't hit inside the sproc. Debugging T-SQL in a sproc on a SQL Server 2008 R2 Express database works as expected in Visual Studio 2010. To be sure everything was enabled properly,

How to prevent Visual Studio from launching WcfSvcHost.exe while debugging?

ε祈祈猫儿з 提交于 2019-11-27 01:56:09
I have a solution in Visual Studio 2008 which has multiple projects. One of the projects is a WCF project. Sometimes I just want to debug other projects, but when I press F5, Visual Studio has wcfsvchost.exe launched to host the WCF project even it is not "StartUp Project". Currently, every time I debugging other projects, I Have to Unload the WCF project to prevent the annoying WcfSvcHost.exe host pop up. However, it is not convenient. Anybody know better idea to prevent WCF project to be hosted in debugging mode? Go to WCF Options section in the property page of your WCF project and unselect

Disable noise messages in debug output windows - visual studio 2012

你说的曾经没有我的故事 提交于 2019-11-27 01:31:59
问题 How do I disable messages in the debug output windows of visual studio 2012? The thread '' (0x2360) has exited with code 0 (0x0) Since the count of such messages is so high they bother me and hide my custom debugging information written using Debug.Write . Should I highlight my custom debugging information using red instead? 回答1: Right click on the Output window for the Debug selection; here you can select which types of messages to see. The Thread Exit Messages option will be disabled in the

How to get non-current thread's stacktrace?

我的未来我决定 提交于 2019-11-27 00:53:37
问题 It is possible to get stacktrace using System.Diagnostics.StackTrace, but thread has to be suspended. Suspend and Resume function are obsolete, so I expect that better way exists. 回答1: According to C# 3.0 in a Nutshell, this is one of the few situations where it is okay to call Suspend/Resume. 回答2: 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