Unable to attach to process. General Exception - visual-studio

This is from Visual Studio Community 2022 64-bit 17.1.1, "Current."
The binary to be debugged was compiled on Windows 11 with the same IDE, but I'm running it on Windows 10 Pro. Once it starts, I'm trying to attach the debugger.
The same file system contains all exe, lib, dll, obj, and source, all in the same places and full paths, as it's mounted in the same position on both computers (T:).
Attachment type is "Automatic." I'm doing Debug->Attach to Process, and clicking on a PID.
The same workflow succeeds on connecting the debugger on the same IDE on the Windows 11 box where the exe was compiled.
All processes belong to the same user (me).
Googling is finding nothing at all except red herrings about remote debugging (I'm trying to debug on the computer running the binary) and permissions.

OK, I'm not sure if this answer will help others, but on Windows 11, when I select the binary in question, the "Attach to:" menu comes up as "Native Code" automatically. On Windows 10, the same Visual C++ release, attaching to the exact same binary, for some reason is detecting it as Python. Manually setting the Code Type to "Debug these code types:"-->Native allowed the debugger to attach correctly.

Related

Visual Basic standalone executable

I have a very simple program written in Visual Basic in Visual Studio 2022. It's a single form with 4 text boxes with things like name, company, email and phone. When the only button is pressed it appends whatever is in those boxes to a *.csv file. It works great on my computer when I press F5.
If I put that executable on another computer it doesn't run at all. There's a dll file that's generated, when I put that dll along with the executable on another computer I get an error message: "You must install .NET Desktop Runtime to run this application. Architecture: x64, App host version: 6.0.7"
I would like this to be a standalone executable that will work on any Windows machine.
Thanks!

Assign executable file name for debug session (Visual Studio 2019)

We have a legacy Visual Studio 2003.NET C++ DLL project. Still works with VS2003 on Windows 10 but we're looking to migrate to VS2019.
In VS2003 when you debug (F5), the box Executable for Debugging Session pops up. In the Executable file name box you select Browse... and navigate to the .EXE which will consume your DLL. Great!
But how to do the same in VS2019? Whenever I debug, Visual Studio thinks I'm using the Local Windows Debugger and I get the error "[PATH][PROJECT].dll is not a valid Win32 application". The Debug > Attach to Process... option is not right either because my target executable is not running yet.
If I'm understanding the problem correctly, I think you want to select the Debugging section of your DLL project's property pages. There you can choose which debugger to use and you can even set the executable you want to launch.

Multi-byte character set is not found in VS2015 VC++ Redistributables

I have created a simple plane MFC application using VS 2015 and if i try to run the exe in another windows 10 machine where VC++ 2015 redistributables are present, then exe is not getting launch.
If i change it to Unicode then it works fine in another machine where VC++ 2015 redistributables are present, its failing specific MBCS.
in the Event viewer i noticed below error,
"Application popup: MFCApplication2.exe - System Error : The code execution cannot proceed because mfc140.dll was not found. Reinstalling the program may fix this problem."
i checked the mfc140.dll its present in system 32 folder, also i placed the same dll at the exe level and run. again new error noticed in event viewer like
Application popup: MFCApplication2.exe - Application Error : The application was unable to start correctly (0xc000007b). Click OK to close the application.
For testing purpose, i made the application as static linkage, in that case its working fine in another machine, but for dynamic linkage the exe is not launching in another machine.
Here are the list of VC++ Redistributes present in the windows 10 machine.
How we can fix the issue?
Edit,
Here i found MBCS installer for 2013 (http://go.microsoft.com/?linkid=9832071). But if i run i'm seeing below error, why we require VS for running MBCS i'm not understanding.
thanks

Cannot run CMake executable with or without debugger under Visual Studio 2017: "Access is denied."

I'm attempting to run a program built with a CMake-generated solution file under Visual Studio 2017's debugger in order to debug a problem. However, whenever I try selecting Start Debugging or Start Without Debugging I get the following error popup.
Unable to start program
'E:\build\someprogram\build\x64\Debug\ALL_BUILD
Access is denied.
At first glance the problem sounded like the one described here. However, that bug was allegedly fixed in VS 2017 15.5, and I currently use 15.6.7. And the location of the compiled executable isn't on a RAM disk or network drive, but on a physical drive. And the error happens when running without a debugger also.
Also I wondered about whether or not the executable was not properly configured, since it looks like the error is related to the ALL_BUILD target, but in my CMakeLists.txt I have this declaration:
add_executable(someproject ${SOURCE_FILES})
I would think that would add the executable to run. It also appears as a subproject in the Solution Explorer.
The compiled .exe runs outside of Visual Studio fine, although it crashes, which I'm trying to debug. Strangely, I cannot enter the Visual Studio debugger from the Abort/Retry/Ignore dialogue that appears after the crash by clicking Retry like it instructs; the window for choosing the Visual Studio version never appears.
It does not seem to be a permissions issue since I manually adjusted the permission of all the build directories with all permissions, with no changes. I'm also running Visual Studio with administrator privileges, and it makes no difference. Additionally I replicated the build process on an entirely different machine (Windows 10, as opposed to Windows 7) and the exact same error occurs, so I'm suspecting it's a CMake issue.
You need to set a different project as startup project (right click on your target executable project "someproject" and select "Set as StartUp Project" from the context menu). ALL_BUILD is a symbolic target and is not connected to an executable.

How can I select GTAV in Visual Studio Graphic Debugger applications?

I am using Visual Studio Graphics Debugger in VS2017 and only shows MS apps. I even selected it in the edit and added it and GTAV is in running state but can't be selected:
Update: (Regarding Gareth's answer):
I already showed my directX control panel, there's nothing further I could do:
Also, in other debug options, after clicking, it shows the same thing as the first window:
It looks like the limitation is not related to the debug targets all being MS, as Candy Crush is by King.
What they do seem to have in common is that they've all been installed the same way, probably through the Windows Store as App Packages, while GTA was installed with an executable installer.
Consider looking in the "Other Debug Targets" or "Attach to Process" menus for attaching to non-App Packages. The DirectX Control Panel menu item may also be worth reviewing.
Debug Installed App Package only works on Universal Windows Platform (UWP) apps. GTA V is a Win32 desktop app, so it would not be expected to show up in that menu.
You can run VSGS on a EXE by opening it with Visual Studio, and then using Debug / Graphics -> Start Graphics Debugging. It's quite common, however, for Win32 desktop applications to use 'ripple' launchers, so the EXE you start isn't actually the Direct3D game EXE.
Applications are also free to request that Visual Studio not support capturing them via an API, which is possible here as well. This is done via the D3DPerf_SetOptions(1) method, use of the D3D11_CREATE_DEVICE_PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY flag, or by reacting to the value returned from IsAnnotationEnabled:GetStatus or ID3D11DeviceContext2::IsAnnotationEnabled.

Resources