Visual Studio 2010 Debugger jumps around - visual-studio-2010

I have a simple C# Winforms application. It isn't multi-threaded (yet). When I debug it and step through the code at work, it debugs just as expected with the debug cursor moving line by line. But when I try doing this at my home computer, it behaves very erratic. The cursor will randomly jump to an unrelated line of code in the middle of another method that hasn't even been called yet etc.
The differences are:
At work I use VS2010 Professional, at home I have VS2010 Ultimate
At work, I use Win XP, at home I use Win 7 Ultimate
At work, its a dual core Athlon, at home a quad core Phenom II

Your symbols file might not match your source. Try deleteing your /bin folder and rebuilding the solution.

Make sure that the project configuration is set on Debug (not on Release!):

If you use other Projects too, make sure to go to Build => Batch Build and check if you build those other projects that you run as well
I'm not sure which one will work for you but you should either tick the Build option or by Modifying Solution Config from Release to build,also you might need to delete your Bin Folder and Build from scratch.Then eiter click on build or do it from Solution Explorer. As shown you can Build other parts of the project and Debugger works rationally again.

Related

DLL testing in visual studio

Hi guys i'm new both to this site and to testing and i'm having trouble finding solutions to this problem.
My current project produces a .DLL file as its build and im looking to use visual studio to automate testing on it every time a new build kicks off.
To run the program a .exe must be triggered in the same directory as the newly created .dll this isn't a problem and wouldn't need automating except i need to kick of 16 different variations of it using different config files and separate machines on a physical network for each variation.
Is there anyway to do this using visual studio 2010 ultimate and MTM?
I have looked into generic testing but it runs the exe without moving the new .DLL to the working directory any ideas?
Thanks in advance.
I haven't used VS 2010, but I know in 2008, you can specify Post-Build actions in the project properties, that you could use to copy the output where you need it to go. I would give you more details, but I'm not at work to look at the interface at the moment.

Code changes are not included to build- Visual Studio 2013

I have recently moved to Mac and am developing using Visual Studio 2013 from Parallels. I have pulled a project from BitBucket repo using Sourcetree.
Now any code changes I make do not translate to any changes. For example, I can comment out all Start up routines and project works fine (just like before commenting).
In addition, all breakpoints are displayed as empty balls with an exclamation mark on them (The breakpoint will not be hit. The source code is different from the original version).
I tried cleaning, rebuilding, deleting obj / bin directories to no avail.
Usually the remark 'The source code is different from the original version' is true.
The only hint is 'Parallels' however that should not be a problem. A few guesses:
Are you running a web project with ISS development host? It could run your site from another folder, however VSS will attach to this instance.
Do you have build output errors (See the errors tab). If so, check whether the setting 'Run last successful build' is enabled. This could disable running your unexpected binaries.
Is there a overridden entry point for debugging? It could be a precompiled version is included in the sources or from some other location. In this case deleting obj/bin folders won't work.
Just let's make sure this is not related to Parallels. I personally use Fusion with Unity but I expect similar tech. Is it a Bootcamp installation? In that case try to boot native and find out whether the problem still exist.

Visual Studio 2010 F5 Debugging C++ is not Rebuilding

I have a Visual Studio 2010 Ultimate C++ project (not managed or .NET). When I press F5 (i.e., start debugging), I want it to save all the files, rebuild those that changed, link the whole thing, and then run. Instead, it appears to use the last build. Thus, when I try to step into a function or something, I get the following error:
Based on my research, I have verified these options, the first three of which are in the Options dialog (can be reached under "Debug->Options and Settings"):
"Projects and Solutions->Build and Run->Only build startup projects and dependencies on Run" is checked. Some research indicated that it should be unchecked, but in my case I actually do only want it to rebuild the startup project. For what it's worth, I've tried unchecking it, with no effect.
"Projects and Solutions->Build and Run->On Run, when projects are out of date:" is set to "Always build".
"Debugging->Edit and Continue->Enable Edit and Continue" is checked, though it's greyed out.
In the Configuration Manager ("Build->Configuration Manager"), all solution configurations and platforms have their "Build" checkbox checked.
I have also tried deleting all Debug and Release directories as well as the .sdf and ipch directory.
For completeness, I suppose I should mention that I'm using precompiled headers, though I kinda doubt it matters.
[EDIT: I should note that it only seems to be one file (a .h file) that's doing it. I tried renaming it and recompiling, and also removing it from the solution and adding it back in, but it didn't work. ]
I was able to bring my solution back into the right state after deleting all .suo and .csproj.user files. Answer led to this solution. Hope this saves someone time.
I fell into this state after installing Ultimate over Professional and running profiling tools.
Once I had similar problem with my C# project and I think I have tried every possible suggestion available on internet but none worked and then this is what I have done:
Created an empty Project
Added startup function to verify that it does not show any error
Imported all my source code manually one by one
So, Yes, it was the solution. You already have done a lot so I would say you can get lucky by trying here and there however having a new project and importing your individual source file would be faster.
Another solution could be that switching the platform. I noticed that when I when to project properties, the new project I had just created had a platform of 'win32' and my other projects in the same solution had it set at x64. After I switched my project to x64, everything worked just fine. This worked for my interop(C,C+, C#) project and hopefully works for other projects as well.
I have successfully resolved it, try the following:
remove all temporary and intellisense files
remove all project from solution and then add them back(most important)
check projects 'Frameworks and References' to ensure they are valid

Recover a .CS class file after crash

I was working on a class in visual studio 2010 when suddenly my computer crashes. after I restart the computer. I start Visual studio and I find that class to be completely empty.
it contained more than 1000 lines of codes before the class.
is there anyway i can recover that file?
Help please because I don't have another copy of it (Stupid of me)
If you cannot find the source code file, try using Reflector to decompile the most recently built dll you have containing that class. It won't give you your complete source, but at least will give you something to start with.
Note: Reflector is no longer free; if that matters, try dotPeek from JetBrains instead.
Also, look into using a source code control system. This will let you 'commit' versions of your code to a repository, so you'll have a copy in case something like this happens in the future.
Subversion, Git, and Mercurial are popular ones; In my opinion, Subversion would be the easiest to start out with, especially with TortoiseSVN (OS integration) and AnkhSVN (Visual Studio integration). If you don't want to worry about setting up a repository/server, look into a hosted solution, like Beanstalk, which offers Subversion and Git and lets you try it out with a free, limited account.
Good luck - I hope you are able to recover your source!
Something which worked for me was back-up.
BTW I was trying to recover a VS2013 file on a Windows 8 machine.
Try to check in below location in your system.
C:\Users\username\My Documents\Visual Studio \Backup Files\ProjectFolder
I found an original file with original-date.filename.cs name and a recovered-date.filename.cs files.
The original was the one needed.
Deleted the one in project, added the original file and renamed it to file.cs. Tried building and debugging and it gave the expected results.
Also just want to add one more thing...
In my case i had an aspx page with its respective .cs and designer.cs
The .cs file got corrupted and I did build on project, with the designer.cs the project got build successfully and the dll got replaced. And when i tried to recover using reflector everything was in a state no return. :(
So don't build the project if you see any file got corrupted.
in visual studio 2019 I find the file in a files with TMP extension
FileName.cs~xxxxxxxx.TMP
This happened to me a few times as well when Visual Studio was crashed or System was shutdown unexpectedly.You can recover these corrupted file using Recuva. It dose not recover the file every time but in most of the cases it's work perfectly.
Below are the settings which you need to configure before recovery.
Start Recuva. Enter Advanced mode if the Wizard launches.
Click Options.
In the Options dialog box, click the Actions tab.
Click Scan for non-deleted files, and then click OK.
Run the Recuva scan as normal. Non-deleted files are indicated with a green double-circle status icon.
Hopefully, you will find your corrupted file in recovered files as it recover multiple versions for that file.
Very useful question. I got issue of file crash on sudden shutdown of my PC. recovered file using "Recuva"(download link: https://filehippo.com/download_recuva/) software. Scan for non-deleted files was helpful.
I got help from: https://www.samnoble.co.uk/2014/11/30/visual-studio-crashes-and-a-corrupted-cs-file/
Well, that happen recently for me and I did get my file back this way.
1. Find the project DLLs in the bin folder. Example MySolution.dll
2. Download and Install .Net Reflector from https://www.red-gate.com/products/dotnet-development/reflector/trial/thank-you
3. Open the .Net Reflector app and click the open folder icon then move to your bin directory and select MySolution.dll file
4. Then traverse and expand through your namespaces and classes to look into your codes.
5. Have fun!

Debugging different projects in VS6

I have 3 projects in a VS6 workspace.
One is the main program, which calls - depending on configuration - one or both other progams. To call the other programs a exe is executed.
If I want to debug and set breakpoints in one of the subsequent programs, I get an error that breakpoints could not be set and have been deactivated.
Are there any VS6 settings I can check?
This is a legacy tool and neither the architecture nor VS6 can be changed. To make things worse I am not very familiar with VS6.
I don't remember exactly the behavior of VC6, but i think you can start 3 instances of Visual Studio, each containing one of the projects (you'll have to create 3 different workspaces). Within each instance you can debug one program. This at least worked with later Visual Studio 2005.
A common reason for that error is if you have set one or more of the components to build in Release mode. Make sure that they're all set to build in Debug mode.
Can't remember where those settings are I'm afraid, but I think they're fairly easy to find (under some project menu?).

Resources