VS2017 Debugger Breakpoints not working with locally run Azure Function - visual-studio-2017

I've used Visual Studio 2017 to create a queue triggered Azure Function. All that the default generated code does is write a message to the log. The code works, but if you set a breakpoint on it, it is ignored by the debugger.
I have same problem with another queue triggered function that has more complex code, but I created this one as a very simple test case.
What do you have to do to get debug breakpoints to work on this type of project?

Answer was found here which is:
(1) right click your project and go to properties page
(2) select "Build" on left
(3) click "Advanced..." button
(4) change "Debugging information" to "Full"

As stupid as it sounds, I managed to make it work by unchecking the option
Automatically close the console when debugging stops
in Tools > Options > Debugging > General

Related

OutputDebugString function don't send the message in my console app

I try to send debug mesage with OutputDebugString function. I use this function in my dll project and i get this message in DebugView. I also use this function in my console app project(same solution) but i can't get messages. All messages appear in the DebugView except for the console application. It does not even appear the simple OutputDebugStringA("debug"); or OutputDebugString(L"debug"); codes. What could it cause?
One issue is that whether you visit it in your VS output window or the tool DebugView here: https://technet.microsoft.com/en-us/sysinternals/bb896647?f=255&MSPPError=-2147217396. They are different.
If you use the Debug view, not debug your app, just run it using "start without debugging(Ctrl+F5)".
If you use the VS output window and other apps output normally, just the specific console app has this issue, I don't think it is related to the debugger tool, we would think about the project itself or VS Settings.
(1)Please set a breakpoint in the code line "OutputDebugString(L"debug");", and then debug your app using "F5", after the breakpoint was hit, click "Step Into (F11)", and then visit your debug output window. Maybe the specific line code was not called in your side.
(2)Since there are different projects in the same solution, please set this console app as the start up project. Or you could just create a single solution for this project, debug it again. At least, we could know that whether other projects impact this specific console app.
(3) Just test it in other VS IDE, make sure that it is not the VS IDE issue. I just use the default VS settings in my side, it works well.
Reference:
https://blogs.msdn.microsoft.com/reiley/2011/07/29/a-debugging-approach-to-outputdebugstring/

Can't use data breakpoint C++, Visual Studio 2013

I set debugger to Native Only, solution configurations is Debug but New Data Breakpoint... option is still greyed out and I can't use it. Can anyone prompt me what else I need to change ?
Make sure active project debugger setting is "Native Only".
Start the debugging with another ordinary breakpoint, then you can see "New Data Breakpoint" is clickable. (In other words, you must be inside debug mode to be able to create a data break point.)
Hope this helps..
Also be sure to look at Tools -> Options -> Debugging -> General and make sure "Enable address-level debugging" is checked.

Is it possible to run a unit test in debug mode?

I've fixed a null reference problem. Now when I run the test related to that class, it fails. I'd like to know whether is possible to run a test in debug mode so I'll know why I am getting the exception?
The test was written by some else, it's calling a method, as part of the setup, with a lot of logic in it. I'd like to step in to see how values are being returned.
Thank for helping.
It is indeed possible, using the NUnit Test Adapter for Visual Studio 2012.
Also, just so you're aware: failed assertions will throw exceptions, causing the debugger to break execution. You can adjust your configuration to work around this, as described in this thread:
Debugging in VS2012 with NUnit without throwing exceptions?
You can also use ReSharper, which makes it pretty easy. Or, you can just go into the properties for your DLL project that has the test in it and make the test runner you are using the exe that runs when you run the project.
Right click the project in the solution explorer, select "Properties" from the menu, go to the "Debug" tab, click the "Start external program" radio button then set the project as the active project and run in debug mode.

Visual C++ 2008 - breakpoint cannot be hit

I am trying to dissect a legacy application through debugging, but I can't get the breakpoint to hit in certain places of the application. The application has a c# GUI frontend and a c++ backend.
I am trying to put a breakpoint in a c++ project of the solution. There are a couple of c++ projects, but I cannot set a breakpoint in one of them. I tried deleting bin/obj files but had no luck.
Afterwards I checked debug > windows > modules, and then noticed that the dll for that particular project is not being shown. The program executes correctly, but perhaps since there is no entry for that project shown in debug > windows > modules, a breakpoint cannot be set. The problem is, I don't know how to make a fix to this problem. Can anyone give a helping hand?
Thanks a lot in advance.
It sounds like you need to enable unmanaged code debugging. Try the follownig
Right click on the C# project and select Properties
Go to the Debug tab
Check "Enable Unmanaged Code Debugging"

Why doesn't Edit & Continue work for me in VS2008 with a legacy C++ win32 project?

If I create a new win32 C++ project in VS2008 I can use Edit & Continue with it just fine, but with this legacy project I'm working with my attempts to use / enable it have failed.
Here are things I've checked:
Tools -> Options -> Debugging -> Edit and Continue -> Enable Edit and Continue is ON.
Debug Information Format: Program Database (/Zi)
Code Generation -> Enable Function-Level Linking: Yes (/Gy)
Looked for a corrupt .ILK file. I can't find any .ILK files - are they still used in 2008?
But when I step into the program, change the next line, and step again, I get:
"This source file has changed. It no longer matches..."
rather than
"Would you like Edit & Continue to apply your code changes."
What's wrong with this project that E&C doesn't work?
I assume you have debugging symbols/etc and the legacy C++ application had been compiled with this support...
If not, then you will run into the problem that the code was not 'instrumented' to allow for injection of alternate code.
I would suspect that the changes in output code format would make VC++ 2008 incompatible... as I doubt Microsoft added such backwards compatibility in (until VS 2008, I think they even made it hard to use older versions of .Net without using the specific VS)
This messagebox
This source file has changed. It no longer matches the version of the file used to build the application being debugged.
seems only to be appearing when I made a code change on the exact line where the breakpoint is.
I've found that I can just click the OK button. And when I then press F10 to actually execute the line that has changed, "Edit and Continue" kicks in and recompiles the code.
After that, the breakpoint is disabled though (it shows a yellow triangle with an exclamation mark):
To re-enable it, you can just right-click the breakpoint and choose "Location...":
which brings you to this dialog:
:
where you need to check the "Allow the source code to be different from the original version" checkbox. Click OK and your breakpoint will be enabled again.