is it possible to debug my solution while debugging a test? - visual-studio-2010

I've got VS2010, nunit, and resharper. I've written a bunch of tests and when I debug those tests I can set breakpoints within the test code itself and those are hit, but no breakpoints within my solution itself are hit (the actual code that the test code is calling).
Is there a way to hit the breakpoints throughout my solution while debugging a test?

Have you tried Tools->Options->Debugging->Enable Just My Code

This may happen sometimes if you have build errors and debugger is executing binaries from previous build (Launch old version). This option can be disabled in Visual Studio:
Tools -> Options -> Projects and Solutions -> Build And Run
On Run, when build or deployment errors occur
The message box is not displayed and the newly built version of the
application is not started. This option is set when you select Do not
show this dialog again in the message box, and then click Yes.

Related

Edits were made which cannot be compiled. When using Resharper in VS2019

I have a multi project solution using .Net Core 2.1
With VS2019 16.3.9 and Resharper 2019.23 Build 192.0.20191016.60459
If I try to run a test in debug, it will run ok once.
On the second run I will get the error
Edits were made which cannot be compiled. Execution cannot continue
until the compile errors are fixed.
I have tried deleting the .vs folder
A similar question is asked here but I thought it was worth starting a new question as this is related to Resharper.
I get the error in the VS unit test window and in Resharper's test window.
Potentially this is caused by Visual Studio's Edit & Continue feature.
A workaround is to disable this feature:
Debug --> Options --> Debugging --> General --> uncheck Enable Edit and Continue
Solution taken from here.
Make sure than your debugging things are like this:

Data Tips in Visual Studio on Release Configuration

How can I get Visual Studio 2017 to display data tips while running in Release Mode rather than only in Debug Mode?
Data tips are the tool tips that pop up when hovering the mouse over a property, variable, etc. while paused on a breakpoint.
I've read that these are only displayed while running in "Debug" configuration, but for one of my current projects, the program will only run correctly while in "Release" configuration. This is making it extremely difficult to debug anything.
UPDATE:
Today it started working for me without me having changed anything.
The only explanation I have is that on the previous night I switched to Debug mode, built the application (which failed with errors), then switched back to Release mode, and built again. When I ran the application the next morning, the data tips were back.
(1) Disable Optimize Code option under your project properties.
(2) Enable Use Managed Compatibility Mode under Tools->Options->Debugging->General.
And then debug your app in release mode, check it again after the Breakpoint is hit.
(3) Maybe it was related to your project files, so you could re-open your project, view it again.

How to figure out why ReSharper is not rebuilding unit test project before running?

Recently I am having an annoying problem. When I go to Unit Test Sessions window and run some tests, ReSharper seems to completely ignore any changes in my code(even in the code of the test itself!) and does not rebuild anything. Because of that I have to rebuild everything manually. I think that problem is too generic to post on bug-tracker so I would like to find at least any additional information. For MsBuild I can always enable diagnostic logging and track all its decisions during build. How can I find what is the problem with ReSharper?
Versions:
Visual Studio 2015 Pro Update 2; ReSharper Ultimate 2016.1.2.
Have you installed the Rider EAP by any chance? There is a bug in the latest EAP (EAP7) that sets the build action before running tests to "Never", and since the global settings file is shared between Rider and ReSharper, this also causes ReSharper to not build tests before running. The fix is simple - just change the value in the drop down in the unit test runner window. See the bug report for more details.
One thing I'm not sure on is if this is a recurring issue - i.e. the value gets reset to "Never" every time Rider opens the unit testing window. This is an unfortunate bug, and will definitely be fixed for EAP8.

Visual Studio 2015 does not hit breakpoint when debugging WF workflow

Visual Studio 2015 does not hit the breakpoint that I set when debugging WF workflow. Are there any settings that I have missed?
Steps to reproduce:
Create new workflow console application
Create workflow, e.g. just a WriteLine activity
Set breakpoint on activity in workflow designer
Hit F5 to run in debug
This works fine in VS 2012 and 2013, so I am thinking that either I am missing a setting or there is a bug...
Solved by disabling "Just my code" in debug settings. In my opinion the workflow is "my code" though...
I have bumped across this issue multiple times where Workflow does not hit the breakpoints in the designer. This is not something specific to VS 2105, since I have encountered this with VS 2013 also.
As a resolution, You will need to move any random control in your workflow, save, build the solution and then give it a try. The root cause of the problem is that there are scenarios when the debug symbol line in the XAML does not update, and hence Workflow is not able to identify recent changes.
If you are able to recreate this issue again, check the debug symbol line in the XAML file & you will find that it did not update. Once you just move any control on the workflow, the debug symbol should be getting updated and your breakpoint will be hit in the designer.
Let me know if this does not resolve this problem.
When "Just my code" is disabled (unchecked) then step into (when debugging code) does not work.
In documentation you can find a warning box with text:
Ensure that you select the option Enable Just My Code (Managed Only) from the Tools, Options, Debugging menu before you debug. If you have two sequences nested within another sequence and you set a break point on the first inner sequence, pressing F11 will not debug into the second inner sequence if the Enable Just My Code (Managed Only)option is not selected.
https://msdn.microsoft.com/en-us/library/dd489405.aspx?f=255&MSPPError=-2147217396

VS 2010 debugger not loading symbols when attaching to NUnit

(I just posted this in the NUnit discussion group on groups.google.com)
Under VS 2008, I would run my tests under NUnit, and, if I needed to
debug, I would attach the VS2008 debugger to the running Nunit process
(Debug -> Attach to Process), and set any breakpoints on code I wanted
to examine. When I hit the Run buttion in NUnit, it would hit the
breakpoint. (BTW, if it matters, this was running NUnit 2.5.2).
I just upgraded to NUnit 2.5.4 and VS 2010. When I set a breakpoint,
then attach to NUnit, I get a little warning symbol on the breakpoint
dot, and hovering over it gives the tooltip "Breakpoint will not be
hit. No symbols are currently loaded". Going to the Debug -> Windows -> Modules window shows a whole bunch of Windows and NUnit modules
loaded, with the Symbol Status of "Skipped loading symbols", and then
1 module with a funny name that changes each time (r1euhmh5 right
now), and Symbol Status of "No symbols loaded". (There is no trace of a module with a name remotely like my DLL under test).
Right clicking the funny filename (assuming that to be some mapping from my
DLL under test), and clicking Load Symbols From -> Symbol Path, and
navigating to the bin\debug folder, then clicking the pdb file of my
DLL under test, I get the message "A matching symbol was not found in
this folder". (The top of the Open dialog box has a line that says
"Original location: r1euhmh5.pdb")
So what's changed? And how do I go about debugging/breakpointing
under VS 2010/NUnit 2.5.4 (Or is it possible I screwed something up
when I decided to go through my VS2010 options and set some of them to
more advanced levels than I knew what I was doing?)
I appreciate any help.
I'm not sure I understand exactly why, but the answer is to attach the debugger to nunit-agent.exe instead of nunit.exe. See Charlie Poole's response here
There's information on this blog post about how to tell NUnit to use the correct .Net framework in the nunit.exe configuration file.
The benefit to fixing this in the configuration file is that it allows you to set up your unit test project so that you can launch NUnit as an external command when you select Debug -> Start New Instance.

Resources