Data Tips in Visual Studio on Release Configuration - visual-studio

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.

Related

(FORTRAN 90) Visual Studio Watch not displaying variables, although they appear in Locals for debug mode - identifier is undefined

I have just reloaded a project on visual studio (2019) that I was using a few days ago and the watch function in debug mode does not appear to be working anymore. I have normal debug flags (no optimisation and full debug information) and as far as I can remember I have not changed anything from the last time that I used this project (when the watch function was working normally). Apart from this, the code runs normally and without bugs.
When the code hits a breakpoint, although the local variables appear in the locals tab, when trying to view variables in the watch 1 tab, all variables (even those defined locally) appear as identifier "..." is undefined. Hovering over variables has also stopped displaying their value.
I have tried restarting visual studio, clean and rebuild, restarting the PC, opening a different project and creating a new project, but the problem persists for all of these.
Maybe there is a switch that I have changed accidentally since the last time it was working? Thanks in advance!
I managed to fix this by using the visual Studio installer and using the repair option under more->Repair. After the repair and a restart, the issue was solved.

Visual Studio 2017 Enterprise Diagnostic Tools no longer shows events at all

Okay so it appears in the last week or so my Enterprise Visual Studio 2017 can no longer get the 'Events' to populate at all for the Diagnostics tool. The tool shows up and runs just fine, it however does not have any events even as I can see and when clicking the filter. Except funny enough it can load symbols and still hit breakpoints and even tell me: "Yep I got your breakpoint event". The problem being I used it a lot for ADO.NET and data tracking to double click an item and get the 'historical debugging'. Basically the 'Filter' says I don't have events yet and even if it hits a breakpoint it only acknowledges the one event.
Things I have tried:
Deleting the SUO files for the solution I am on.
Checking the Debug General Options against another Dev whose is working. And ensuring 'Enable Just My Code' is on.
Changed Configuration settings from Debug to Release and changing CPU configs to see on the off chance this could be it.
Shut down the PC and rebooted.
I tried suggestions on this thread:
Visual Studio 2015 diagnostic tools no longer working
In your screen shot, it just has the break events, no IntelliTrace Events.
(1) Please add a breakpoint in your app, and then debug it, after the breakpoint was hit, check the Event.
(2) I think you could enable the IntelliTrace under TOOLS->Options->IntelliTrace, please enable IntelliTrace. Debug it again.
(3) Of course, not very sure that whether it is related to the project type, for example, just create a simple Winform app, test 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.

is it possible to debug my solution while debugging a test?

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.

Visual Studio detaches from application as soon as debugging starts

I have a web application that I've always been able to run in Visual Studio and it debugs just fine (breakpoints work, I can pause execution, etc). Recently, the behavior changed suddenly, and a few things happen:
I start debugging, it lauches IE and loads the application, but after a few seconds (sometimes the page hasn't even displayed yet), Visual Studio acts as if debugging has stopped - I'm able to edit code in VS again, and the "Play" button on the toolbar is enabled. The application continues to run in the IE window just spawned, but I'm not attached to it
During this few seconds that VS is "debugging", because it detaches, my breakpoints show as hollow - as if I'm set to "Release" mode and they won't be hit. In fact, I have a breakpoint set in Page_Load, and it skips right by. I've checked, and I'm set to debug mode, though the compile mode dropdown is missing from my toolbar (I checked in the build properties to ensure I was in debug mode).
Can anybody shed some light here?
It turns out that this was actually a result of an upgrade to Windows Vista. VS wasn't being "Run as an Administrator", which caused it to lack the rights to attach to other processes for debugging. As a result, debugging would stop right after it started. Changing the VS shortcut to run as an administrator resolved this problem.
I've experienced samely looking behavior. The cause was in existence of several <system.web> sections (which is allowed by web.config schema). Visual Studio debugger (versions 2008 and 2010 were tested) looks in the first encountered section only. So if your <compilation debug="true"> tag is not in the first one, it thinks that there are no compilation.debug setting present and genrally tryes to add <compilation debug="true"> to the first <system.web>. In some cases VS2008 just silently procceds in this case. For example look here: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=510354#details"
Have you installed anything else on the server / workstation recently?
We have a third party app that doesn't allow us to debug, w3wp.exe crashes immediately upon an attempt to debug.
I ran into something similar when I had placed some code in a constructor that was crashing. Exact same issues where the Debug would disconnect just after the application started up.
The short if it, check that you haven't configured a class constructor to run during web startup that is crashing...
Quick windows 7 update: I had to add "localhost" to my list of trusted sites to correct this issue...go figure.
Just a workaround for those (like me) for whom the above solutions do not work: After starting the app you wish to debug, go to Debug -> Attach to Process, and attach it to the process you want to debug. Works on my machine.
In my case, I faced this issue with Visual Studio 2019 and 2022 as well.
I tried upgrading/downgrading Visual Studio versions but nothing helped.
On debugging, I finally found the root cause and sharing it here to help others facing the same problem.
I was using Brave browser with Visual Studio and whenever I uploaded a file in my application, the Visual Studio debugging stopped automatically. The root cause of this issue is the feature in Visual Studio to stop debugging on closing the browser. With Brave browser Visual Studio feels like we have closed the browser on uploading the file. So to fix this issue I have turned of this setting as given here.
You can find this setting here
Tools > Options > Projects and Solutions > Web Projects > Stop debugger when browser window is closed, close browser when debugging stops
Just turn it off and everything should work fine.

Resources