cin.get() causes access violation error under Visual Studio - visual-studio-2012

My Visual Studio 2013 console application has suddenly started causing an access violation error just before exiting. The popup error window tells me "Access violation executing location xxx" and it breaks in the VC library function _callthreadstartex. If I comment out the lines I added:
cout << "\nHit Enter to finish\n";
std::cin.get();
it works. Also, when I run it from a command window instead of from the Visual Studio debug environment, it works. (The project file I'm working with does not contain a Release configuration--debug version is all there is.)
The rest of the program is an example from a large open source package, which is too elaborate to list here. The operating system is Windows 7, freshly installed on an older computer.
While I know that this type of error is usually cryptic and intermittent and may not have anything to do with cin.get() at all, can I rule anything in or out? Since the only things I added are standard library calls, programming error on my part is not likely. The package I'm working with is very complex and fragile, but I don't know where to start in using the error information I'm given to track down the problem. Is it possible this is an operating system setting matter that doesn't require a code fix? Is it a threading issue that's outside my expertise?

Related

Microsoft Visual Studio 2012 has stopped working (solutions on Stack Overflow not working)

Error message:
A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available.
This was the error message I got when I tried to launch Visual Studio 2012 on my Windows 8.1 system. There is no other information to act upon other than this, which is rather the same as "We don't know what's wrong. We will tell you if we know (but I don't think we do)". It was actually working before it just decided to stop.
The last configuration I made before it began to show this error was that I selected the option to load the last solution whenever I launch Visual Studio, and this was done in the options dialog. I don't think that could have caused Visual Studio to suddenly crash. The previous error message included something that had to with a change in configuration.
I have checked that ActivityLog.xml file in.
There were basically four errors:
Construction of frame content failed. Frame identifier: ST:0:0:{74946827-37a0-11d2-a273-00c04f8ef4ff} Frame caption: Exception details: System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at Microsoft.VisualStudio.Shell.Interop.IVsShell5.LoadPackageWithContext(Guid& packageGuid, Int32 reason, Guid& context) at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.GetPackage() at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ConstructContent()
SetSite failed for package [Visual Studio Component Model Host Package]
End package load [Visual Studio Component Model Host Package]
End package load [Microsoft.VisualStudio.Editor.Implementation.EditorPackage]
I have searched on Stack Overflow, Bing and Google. The solutions I got from there didn't work. Some had to do with registry settings, deleting keys, etc. I even disabled all the extensions from the registry. There was a time it was showing another message that "Object reference was not set to ...".
I don't know what to do. The only solution I have not tried is the one that I should download the updates. Update 4 is about 2 GB. That will take me, at least a week to download. Is there anything I can do?
PS: I tried to uninstall it. It does absolutely nothing. From the Control Panel, there's only the option to change. Clicking it seems to do something but nothing appears. I tried running from the set up from the .iso file. It shows nothing, too. How can I fix this problem?
There's probably nothing we can help you with here, my view is that you need to reinstall VS. If you cannot uninstall or repair it then you should contact Microsoft.
I am able to fix this problem by installing latest version of of .NET Framework. May be helpful for others as well.

Windows Phone Emulator error

I am getting this type of errors often. But when I restart the system and run the app again there is no problem. Whats the cause of this problem
And Visual studio says the error as this sometimes this error differs...
I'm guessing as Harush says that your don't have enough free RAM available after you've been running the computer for a while and have many processes running. As for the second error I don't really understand from your question as to when it happens (always, randomly, or with the RAM problem?) but as the link below states it happens most often when you mess with the project file manually (when you unload and change the project in the xml editor).
http://msdn.microsoft.com/en-us/library/7dyy0x47(v=vs.90).aspx

"A remote operation is taking longer than expected" x64

First off, I think I've been to every website and forum there is that's discussing this issue and I've tried many different things. I'm at my wits end. This is the dumbest thing and I just want to start coding again!
I'm using Visual Studio Express 2012 for Windows Desktop. I have a x64 project I'm trying to run in Debug mode using the local windows debugger. The only external library I'm using is that of which is required to run DX11.
I attempt to run my program and it freezes. A window pops up saying "A remote operation is taking longer than expected."
I click Terminate and another window pops up asking if I'd like to terminate the remote session. Why yes, I would.
Then it says, "Unable to start program (my path leading to my .exe). The network connection to the Visual Studio Remote Debugger has been closed."
To my understanding, because Visual Studio itself is a 32 bit application, it needs to use the Remote Debugger to compile to x64. Is that correct?
Regardless, I'm still failing to see where that would break down. I've ran several repairs on VS and upgraded to Service Pack 2 (or 1, whichever is the latest).
I've ran a windows repair and uninstalled any VMWare type stuff on my computer. I'm not using a VPN.
I've even copied msvsmon.exe from my laptop (working instance of the project) over to this computer and still no luck.
I'm about ready to Nuke my OS and do a clean install on everything. sigh
Found the problem. It wasn't Windows Firewall like other threads describe. It was my internet filter. I guess it decided to try and block msvsmon.exe because it was using the network. Adding it, along with WDExpress.exe to the application exceptions list did the trick.

Visual Studio 2012 Remote Debugging: Invalid access to memory location

I followed the instructions in this link: http://msdn.microsoft.com/en-us/library/bt727f1t.aspx to install the remote debugger (2012) on my server where the application is running in hope to debug it remotely from my dev machine running visual studio 2012.
I cannot even get as far as viewing the list of processes to attach to on the remote machine. I keep getting "Unable to connect to the Microsoft Visual Studio Remote Debugging Monitor named [name]. Invalid access to memory location".
I have managed to successfully connect a few times but then the attach fails immediately then I cannot connect again.
This is causing huge issues for me as I cannot remote debug anything. I must be missing something glaring. Please someone give me a solution.
I've found the only way to correct this is by restarting Visual Studio.
Worked for me. I found it at this blog post about invalid access and remote debugging.
It turns out the one thing I missed was to tell Visual Studio where to find the .pdb symbols relating to the remote process. To do this go to Tools -> Options -> Debugging then in the Symbol (.pdb) locations add the remote location to the pdb files.
To clarify, I was attaching fine but could not break into code. Now I can. Be aware though that there are other hurdles before you get to my stage where I was attaching to the process successfully but could not catch a breakpoint.
I recently had someone else report this and debugged the issue on their machine. The "Invalid access to memory location" errors are due to an issue in Windows, it can be addressed with this hotfix.
I have had this problem in VS 2012, 2013, 2015 and 2017. Based on other answers it is likely that the problem is related to running a 32 bit version of Visual Studio on a 64 bit PC. Sometimes, as others have recommended, restarting Visual Studio fixes the problem but the best solution I've found so far is to start Visual Studio without a solution, open Debug -> Attach to Process, change the Connection Target to the remove server and wait for the process list to load. Then Cancel, do not attach yet. Load your desired solution and then come back to Attach to Process and the remote process list will still be loaded. Connect to your desired process and everything should work properly from then on.

Runtime Error! - Microsoft Visual C++ Runtime Library

I've developed an application in VS 2003 (C++). But while running in a fresh windows xp machine, getting error:
Microsoft Visual C++ Runtime Library
Runtime Error!
Program:
This application has requested the Runtime to terminate it in an unusual way....
What will be the reason for getting this error and how can I solve it? Please help.
This is a very generic error so it is not easy to solve from this information but I can give you a few things to try.
First check that the program runs fine on your developer machine - if not run under the debugger and trap the specific error.
If this problem only occurs on the clean machine it probably does not have the correct runtimes installed.
Your application will depend on a number of dlls that ship with visual studio, you will need to install these on the clean machine.
Your can run depends.exe from http://www.dependencywalker.com/ this will tell you what dlls cannot be found.
These dlls will be on your developer machine, you can either package the yourself in an installer or find the correct redistributable from microsoft.
Another thing to check - have you hardcoded any file locations? e.g. your application could try and open a file, resource, registry key - something that does not exist in your clean machine - if the code does not check for failure you would then probably crash at some point after the read failed to happen.

Resources