How to run execution file of Visual Studio 2010? - visual-studio

I write a C++ program. It can be run by visual studio in Debug mode, but when i click the .exe file in the path: C:\Users\user\Documents\Visual Studio 2010\Projects\NewProj\Debug, it will show "Fail to open the file". I don't know why. My program read some text from a .txt file, after doing some processes, some texts will be output to another file.
Thanks:)

Try switching from debug mode to release mode. Then from the menu in Visual Studio: Clean solution and rebuild the solution. If you get the same error try looking through the event viewer to see a more detailed exception.

Related

PDB remains open after debugging (Windows 10, Visual Studio)

Our previous development systems used Windows XP and Windows 7. Debugging C++ DLLs from Visual Studio worked great.
A recent move to Windows 10 has resulted in an annoying problem. We can debug once (using F5), but the 2nd time results in a linker error:
MyProg fatal error LNK1201: error writing to program database 'MyProg.pdb'
Trying to delete the .pdb manually in Explorer while Visual Studio is still open results in the error:
The action can't be completed because the file is open in devenv.exe
It doesn't matter whether you hit a breakpoint or not. Just start debugging once results in the problem. Re-starting Visual Studio resolves the issue (in the sense that you can debug once, but then you get the problem again).
If relevant:
x86 Visual Studio 2003.NET
targeting another x86 application
x64 Windows 10 Pro v1803
After hunting around for several hours some related, but unanswered, questions were found. Following suggestions in this MSDN article, along with some debugging of my own, this solution works:
Download FreePDB, a script written by MSDN user Toni76 (thanks Toni!)
Copy this script to a local folder (say C:\Apps\FreeDPB)
Download the latest version of SysInternals tool Handle (currently v4.21)
Copy handle.exe to C:\Apps\FreeDPB
NB! From the command line, run handle /? once. This is to agree the EULA. The script will not work if you skip this step!
Open Visual Studio, then Project > Properties > Build Events > Pre-Build Event
Set Command Line to C:\Apps\FreeDPB\freepdb $(ProjectName)
Set Description to Delete lock on PDB
...and now you don't need to restart Visual Studio to debug a 2nd time!
From comments, this works with multiple versions of Visual Studio on multiple versions of Windows.
Update
A more radical solution is described here which involves replacing a core Visual Studio DLL (NatDbgDE.dll). This solution only works for Visual Studio 2003 SP1, though.
In my case it was due to "Process Explorer" program, which was open alongside with my Visual Studio(I used it to check some properties of the exe I've created). After closing it problem solved.

Visual Studio 2010 freezes on build with particular file open

So my Visual Studio 2010 is extremely slow (and sometimes freezes) when I have a particular file open and attempt to compile and run the project. I have to open the Task Manager and kill the process for Visual Studio to regain control. If I close this file, and open any other file in the Solution Explorer in my project, Visual Studio compiles and runs the program just fine. The build succeeds, but Visual Studio just freezes after that. If I attempt to do anything in the IDE, Windows will tell me that Visual Studio is not responding. I've tried commenting out everything but the bare essentials in the file that's causing the freezing, and that didn't work. In order to get my program up and running, I have to close the file and then build the project. Visual Studio will then build and run the program in a timely manner as long as the particular file is not open. This only started a few days ago, and I haven't made any changes to the code that could have done this, nor have I updated or installed anything else onto my computer. Any ideas would be greatly appreciated. Thanks.
I fixed this. What I did was run devenv.exe /log and looked through the log. It had the following warning in it: "The CTM file is out of date and should be deleted and rebuilt, but the file 'C:\ProgramData\Microsoft\VisualStudio\10.0\1033\devenv.CTM' could not be deleted." I went and deleted this file, and it did the trick. Now even with that particular file open, Visual Studio builds and runs the program just fine.

Can't show Debug output on Visual Studio 2012

I tried to configure the storage for my debugging data in Azure Storage by following the instructions in this page (source). After doing this the outputs from Diagnostics like Debug.WriteLine stopped appearing on the Debug output of Visual Studio which I didn't intend to happen.
After a while it was decided it wasn't necessary to store the debug data in the end, so I deleted the diagnostics.wadcfg file and removed the diagnostics configuration from the Web.config file of my role and from both ServiceConfiguration.Local.cscfg and ServiceConfiguration.Cloud.cscfg files, hoping that would restore the output to Visual Studio . It didn't.
How can I restore fully the Debug output to be displayed on Visual Studio console once again? It's really hard to work without these outputs of information.
Any help will be appreciated.
Try going to Visual Studio > Tools> Options > Debugging > Output Window > And check the options there for Output types.
Be sure you are runnning the project un Debug mode and not in Release mode.
In window--->Reset window layout

Visual Studio 2008 Designer File Bug?

This has been driving me crazy for months. I have a multiple projects that compile without errors. If I start copying and pasting controls (or even just plain 'p' tags) the designer will fail 1/2 the time with the error "the method or operation is not implemented". The complexity of the page doesn't matter. The 'solution' is to delete the designer file, exit visual studio, open visual studio and convert the offending aspx file to a 'web application' to regenerate the designer file.
This is a really annoying. I can't find any fixes on Google. Is there a way to disable the automatic designer file? Make it so it only generates on a 'build' command and not fail everytime I'm laying out a aspx page?
Thanks
To find the fix for the issue you would need to find the cause of the issue. It might be possible to get more information on what is causing the issue if you attach a debugger to Visual Studio. This could be done by following these steps:
Open two instances of visual studio (run as administrator)
In one, open your project and get to a point right before the issue occurs
Attach the other instance of Visual Studio to the one with your project (Tools -> Attach to Process)
Perform the steps to reproduce the issue.
Note that to actually catch the exception you will need to change a few debugging options. First you would need to make sure that the Just My Code check box is unchecked in the General debugging options in Visual Studio. The second is on the exceptions dialog you will need to catch thrown exceptions. The exception dialog is under the Debug menu in Visual Studio.

Opening minidump file (*.dmp) not possible in Visual Studio.NET 2005?

I have created a minidump using win32 api
[DllImport("DbgHelp.dll", SetLastError = true)]
private static extern bool MiniDumpWriteDump(
dmp file is successfully created.
i am trying to open this *.dmp file in another visual studio instance to locate the place of the crash,
in visual studio --> FILE--> open project the dmp file option is not available.
i had choose all files in file open menu, and opened the dmp file. but i can't debug,
any idea why my dump file option in visual studio is disabled.
i know i can use windbg, and other tools, it will be easy for me to use visual studio as it is available for me.
I'm not 100% sure. But, I think even if you get it open in VisualStudio, VS doesn't support half the commands that WinDbg does for analysing a dmp. So, I'd just stick to WinDbg. WinDbg is a free download... so that's available to you too. It's not the easiest to use, I always have to open the help to find the commands I want, but it does do a good job.
Download here for 32bit:
http://www.microsoft.com/whdc/devtools/debugging/installx86.Mspx
It sounds like you are opening the dump correctly.
Here is what is says in the Visual Studio Help files:
"To open a dump file
On the File menu, click Open, and then click Project.
In the Open Project dialog box, locate and select the dump file.
It will usually have a .dmp extension.
Click OK.
To find the binaries for debugging a crash dump, Visual Studio 2005 looks in the symbol search paths. To make sure Visual Studio 2005 finds the binaries, you can add a symbol search path in the Options dialog box or from the Modules window. For more information, see How to: Specify a Symbol Path."
You yourself say,
"...and opened the dmp file. but i can't debug"
So you are opening the dump file OK in Visual Studio, but what do you mean, "I can't debug?"
If you can't see your source code, that's because Visual Studio doesn't know where it is. Follow the instructions to set up the symbol search path.
If you can't step thru your code, that's because you can't do that with a minidump. The process that produced the minidump is gone, and it can't be executed further.
If you can't examine the call stack or contents of variables, that's because Visual Studio can't find the .pdb file with the debug info.

Resources