VS2015 unmanaged debugging - c#

The shop where I work is currently using VB6 for development using controls and libraries. Someone once showed me how to use Visual Studio to be able to debug this code by simply creating a console application in C# and then changing a few options. He showed me this in VS2010, but I am now using 2015. When I go into the project properties and go to the Debug tab, the option for "Enable unmanaged debugging" is not there. Did Microsoft remove this option? I have searched the web quite a bit, but have had no luck finding a solution.
Also, for kicks, I also have 2010 installed on my machine. The option is available there, however when I attempt to run and debug I get a LoaderLock failure. After researching it I found that I have to disable the exception in Visual Studio. However, it would appear that my exceptions are locked down and I cannot change them as they are all greyed out. I am an administrator on the machine I am using, but I am unsure of where or what I need to change to enable me to change the exception settings.
Any recommendations on either issue would be greatly appreciated. It's not a show stopper for me, but a HUGE inconvenience.

Related

Memory leak with Visual Studio running alongside web application

I'm running a web application with models defined in C# and views being in HTML5, client-side business logic is JavaScript/jQuery. I've noticed something odd recently. Whenever both Visual Studio and my web application are running simultaneously, the browser memory usage starts to climb. It is worse in IE and Chrome, but likewise substantial in Firefox (all the latest versions of these browsers). Also, the memory usage of Visual Studio starts to climb. The CPU usage for the browser hovers in the teens, normally hovering around 0 otherwise.
Once I close down either the web application, or Visual Studio, the memory stops growing, and indeed, closing Visual Studio often allows the browser to run its garbage collection and clean up the mess. I suspect this has something to do with some sort of background debugging going on. I'm surprised that googling this hasn't turned up a similar issue for somebody somewhere in the world, and I suspect it's some kind of configuration setting in my IDE. Visual Studio 2013 Premium. I've reset my settings (Tools -> Import and Export Settings -> Reset all settings, with no effect. Building in Release mode likewise seems to have no effect. I'll keep hunting this one down, but has anyone here seen anything like this and resolved it?
edit: I have recently been debugging some dynamic code using the debugger keyword. I've commented that out, and am still seeing the same results. But I wonder if there isn't some lingering effect from using this in the first place?
edit: Updating Resharper from 8.2 to 9.2 didn't help either.
edit: Apparently this issue has been seen before and reported, if you just know what to google for.
Visual Studio has a browser link feature that causes the web app to poll Visual Studio in case you have changed a file.
In VS there is a small refresh icon in the debug menu with a drop down. In there you can disable this feature.
Did you trying running the application without debugging? (Ctrl+F5)
To enable VS debug the browser more info is needed specifically things like scripts and eval code are needed even after use. So, running the browser with debugging enabled will use more memory and cause memory to grow with time.

VSP2340 Environment variable issues suddenly when profiling an app

Can anybody explain why i'm suddenly getting this when trying to do any kind of performance profiling (the same way i always have) from within VS2012.
VSP2340: Environment variables were not properly set during profiling run and managed symbols may not resolve. Please use vsperfclrenv before profiling.
I've googled and tried a few things, but i'm unable to find out how to get this working from within VS2012 again.
I found somebody with the same unanswered issue a couple of weeks back here: VS2013: "VSP2340: Environment variables were not properly set" even when running from IDE
Thanks in advance.
I've had the same issue on Visual Studio 2012. Follow the steps below:
Start - All Programs - Microsoft Visual Studio 2012 - Visual Studio Tools
Right click "Open VS2012 x64 Native Tools Command Prompt" and select run as administrator
The command prompt opens. Run vsperfclrenv /globalsampleon
Reboot machine

Could not find type...Platform issues in Visual Studio

I just jumped back into a project that previously had no issues. We just upgraded to visual studio 2012. This morning I open my project to work on my code. I am getting designer issues all over the place.
"If this type is a part of your development project, make sure that the project has been successfully built using settings for your current platform or Any CPU"
It all seems to be coming from this platform issue. I have had zero issues in the past. I cannot find any information on how to fix this. I even go to open the designer on a file that previously worked (pre VS2012 install) and that fails.
So I went back to VS2010...without changing anything and attempted to open the same designer on the same file that previously worked and I also get an app crash.
Did somehow my visual studio 2012 install cause all of this?
Make sure that you are choosing the right CPU architecture for your designer. If it is ARM then you might see that message. You can check your CPU settings for your project like this:

Unable to debug managed code using visual studio 2013 ("Cannot evaluate expression" error - am using debug build) (Note that VS 2012 works)

I have .net application (GUI as well as PowerShell) built against 4.5. My OS is server 2012. When I attach my application to 2013 visual studio, the debugger is not working sometimes. Its not evaluating expression or showing locals (and also watch window/immediate window nothing works - its as if the project is build with release). But I have build with 'Debug' configuration. And as mentioned same thing works when I simply attach with VS 2012 ( yes, I have 2k13 and 2k12 SXS)
Please note that if I attach the same process with the same settings (managed debugging), to Visual Studio 2012 it always works.
I made sure the symbols are loaded (by checking modules tab in visual studio + debug + windows), break points are hit.
Any thoughts on what might be the issue? All the updates are up-to-date as well.
Its kind of annoying to launch vs 2012 just to debug, when I am using VS 2k13 IDE for development.
Regards!
If you are facing the same issue, please look at http://weblog.west-wind.com/posts/2013/Nov/21/Visual-Studio-2013-Could-not-evaluate-Expression-Debugger-Abnormality for details.
Here is the answer which solved for me:
I have set the flag "use managed compatibility mode" in Tools | Options | Debugger | General.
For details, take a look at the link as he explained it nicely as a story :)
Am happy it worked, otherwise I just had to load project in vs 2k12 just to debug it which is annoying.
EDIT on 12th June 2014
I have updated my dev environments with visual studio 2013 update 2 (http://www.microsoft.com/en-us/download/details.aspx?id=42666) (as per Maria's suggestion below) and removed "using managed compatibility mode". I will be testing my apps (ps cmdlets, gui, services) and update you in couple of weeks if the debugger is ok for me.
EDIT on 26th June 2014
I have tested my apps and luckily for me everything is working nicely :). Even the debugger is doing pretty good job with new async/await model. So, see if you can upgrade to 'update 2' - hopefully this works in your environment too?. Thanks to Maria and debugger's team!
Regards.
I deleted all my breakpoints and then it started working, with Visual Studio 2013 Update 1. This was one of the suggestions from the blog post mentioned by Dreamer.
We have released a fix for the issue you are describing in Update 2 CTP 2 of Visual Studio -
Please let me know if that doesn't resolve your issue!
Thanks!
Maria - Visual Studio Debugger
Please note that while the accepted answer probably will fix the problem for now, it's best to be aware of the drawbacks of this solution. Making this change will make VS 2013 use the older style debugger for all you projects. It is a global setting. There are other ways to locally change this for a single project. Please read here for more info on this:
http://blogs.msdn.com/b/visualstudioalm/archive/2013/10/16/switching-to-managed-compatibility-mode-in-visual-studio-2013.aspx
We have a custom expression evaluator and our own language and this warning message to change the settings always appears even after I change the project settings to those specified in the blog.
<DebugEngines>{351668CC-8477-4fbf-BFE3-5F1006E4DB1F}</DebugEngines>
Is there something else?
Our clients are using VS2013 pro. I've turned off all the "Enable the Visual Studio hosting process" for all our projects and also added the property to our clients projects. I still see the warning each time I attack to w3wp.exe.
IMPORTANT NOTE: If your project is using the Visual Studio hosting process (the default for many project types), you must disable the hosting process for this fix to correctly change the debug mode. To disable the hosting process go to the Debug pane on the project properties page, and uncheck "Enable the Visual Studio hosting process"
You can resolve this error by applying below points
Sol 1:
1) Restart visual studio and re-open your project.
2) Open your project bin directory and delete DLL of that code where your debugger is not working properly.
3) Then again add DLL reference in the bin directory.
4) Remove all breakpoints.
5) Build project.
6) attach with one w3wp.exe process in attach to process window
7) Enjoy your problem has been resolved.
If above solution is not working then you can try solution that has been provided on bellow link
http://weblog.west-wind.com/posts/2013/Nov/21/Visual-Studio-2013-Could-not-evaluate-Expression-Debugger-Abnormality
I had a similar problem debugging where this error occurred from a return from creating a class. The class initialized fine (using "new classname()") but then it gave the "cannot evaluate expression" error on the return. Though it worked on previous visual studio versions, running on VS 2017 it crapped out.
After a lot of head banging, it turned out that private variables in the class, especially things like arraylists and other classes, needed to be declared with initial values, even if set to null.
Once that was done, everything worked, even though the solution "appeared" to have nothing to do with the problem and gave no apparent clue of where the problem occurred.
We had this problem with PostSharp extension version 5.0.32 with VS2013 Update 5.
Our workaround was downgrade PostSharp extension to version 4.3.19 or disable it.
Set AutoEventWireup="true" on aspx header file. This will turn debug mode on.

Visual Studio keeps crashing

Visual studio team system 2008 keeps crashing on me. Sometimes it just freezes, or certain parts of the UI get messed up or a weird popup box saying something about unable to load parameters or saying something else about memory or any other number of things.
it usually happens when I do a "complex" task like go into debug mode or do a search across of whole solution or run a unit tests or something like that.
I rebooted my machine countless time, reinstalled it VS, changed my virtual memory settings, flush my page file on every reboot and anything else i could think of.
It seems like VS runs out memory or something.
I have a powerfully machine with lots of RAM so that's not the issue
any suggestions?
You can always try some standard Visual Studio troubleshooting steps:
Clean the solution
Delete / rename all files in your solution created by VS, i.e. all .ncb, .suo, .user files
Launch Visual Studio with all add-ins disabled: devenv.exe /SafeMode
Reset All Settings: Tools -> Import / Export Settings -> Reset All Settings
Delete HKCU:\Software\Micosoft\VisualStudio\9.0 and then restart Visual Studio
Repair the Visual Studio installation through Add/Remove Programs
You might also check whether there is a hotfix available addressing your issue (e.g. KB960075 sounds like a good candidate for you), or whether you find your problem already reported on the Connect website.
The first step is to uninstall all 3rd party add-ins on Visual Studio. In particular if you have multiple add-ins as they can interfere with each other in unexpected ways and cause crashes. After uninstalling repeat your scenarios and see if this fixes the issue.
If not then it's best to consult the application log and find out why Visual Studio is crashing. The log will contain at least the error code of the crash which can searched on google or reposted here for us to take a look at.
Assuming this occurs with VS up to date with all service packs installed, you might try some of these suggestions. If you haven't tried with service packs, do that first.
What version of Windows are you using? If it is Windows 7, try launching Visual Studio with a compatibility mode and see if that resolves the issue. To do this, make a copy of the normal launch shortcut and go into the Properties dialog and set it to run as Windows Vista.
If this doesn't fix it, then you might also consider:
Checking your PATH environment for any weird settings which might be confusing it, e.g. paths pointing to other SDKs
Any 3rd party VS extensions such as source control, refactoring plugins, wizards etc.
Old versions of .NET or SQL server
Also test if the issue occurs for every kind of project or just certain kinds, e.g. does it happen for all projects? Does it happen in C++, C#, VB.NET projects etc.
You can also attach a debugger to Visual Studio, to see what it's doing. Sometimes a particular .sln will trigger bad behavior or more likely, some third-party add-on.
If you believe that you've gotten VS into a wired state, you can try the following command line switches
devenv.exe /ResetSettings (This will reset the visual studio settings to the defaults)
If that doesn't help, as a last resort, you can try
devenv.exe /ResetUserData

Categories