I have a solution that was compiling and running fine in Visual Studio 2022. I added another project to the same solution, did some work on the new project and then checked it all into Devops. Now, everything compiles fine. I can "publish" to a folder and get the EXE and it runs. But I CAN'T run it in Visual Studio or by trying to run the EXE in the bin folder structure. When I click the run button in VS, I get:
The target process exited without raising a CoreCLR started event. Ensure that the target process is configured to use .NET Core. This may be expected if the target process did not run on .NET Core.
The program '[21684] Enable Instant Book.exe' has exited with code 2147516551 (0x80008087).
Now, this is a Winforms application targeting .Net 6.0 on Windows. So I'm not sure why it's suddenly throwing this error nor why it says "CoreCLR" in the error when I'm not targeting Core. I'm so frustrated with it that I'm thinking of dumping it all and redoing it in VS 2019 with .Net 4.x. But I thought I would see if any of you knew some magic to get it to return to a working state first.
Some of the things I've tried:
Clean and rebuild
Remove all projects except the very first one that I know was working and rebuild
Close and reopen VS / Reboot PC
Delete everything in "bin" folder and rebuild
Changing the compile from "Any CPU" to x64
Any ideas?
Related
I'm working in a solution that has several .net core (as well as standard and framework) projects.
Up until this morning, when I debugged a .net core project it would launch fine. This morning, that broke. I get an error stating
The library hostfxr.dll was found , but loading it from XXX failed
When I build the project, and try running the EXE, the same thing
happens.
When I add a new project to the solution, it works fine.
When running the built debug version on another machine (with the
.net core SDKs), I get the same issue
When I change the project to
run in Release, it works fine.
When I change the project to run in Debug, and 32bit, it works fine
When I build the project via cli/dotnet build -c Debug, it works.
When I build the project via Visual Studio, in Debug, in 32bit it works.
When I build the project via Visual Studio, in Debug, in 64bit it doesn't work.
I've cleaned/rebuild the project.
I've restarted
I've updated my Visual Studio
I've removed and reinstalled the .net core SDK
Any suggestions on what happened and how I can fix it?
Im running Windows 10 and Visual Studio 2019
UPDATE
After performing my Windows updates overnight, it no longer works when I use dotnet build.
So it turns out that a clean/rebuild doesnt completely clean the solution.
After I deleted the obj and bin folders, and restarted VS, the problem was resolved.
In our case (with a build server on Windows Server 2019), it was a case of user rights.
The user that executed the build process (Jenkins), did have access to the folder where hostfxr.dll was located, but required to be an administrator on the build server.
Test the process running under the name of an admin, before re-installing frameworks or installing any Windows Updates.
My .NET framework 4.6.1 console application works fine on my friends computer but after cloning the repository and running it on mine it seems to not want to compile. Everything still works the same as it did when I tried debugging and noticed it wasn't working.
Any other application I try compiles fine, this is a bug with this project only.
Extra details, as I was told I didn't example enough?
I've tried compiling it pretty much every way, clicking the Start button with the green triangle, F5, CTRL+F5 and none compile the code. It runs just as it would if it worked, it just doesn't apply changes I've made in the source code when debugging. I'm using Visual Studio 2015.
In Visual Studio, go to Build > Configuration Manager
With Active solution configuration set to Debug, make sure that your console application project has the Build checkbox ticked. This is usually ticked by default.
Otherwise you can explicitly build your project by selecting Build > Build ProjectName (Shift+F6) or right-clicking your project in the solution explorer and selecting Build from the context menu.
When I build a C# program (this has been going on for several different solutions/projects I have been working on) in Visual Studio 2017, the new, updated code will build and run in debug mode (and run correctly).
However, the application that Visual Studio has been outputting when I build/debug them has been remaining with the original, first version of code that I saved. When I choose the options to rebuild, it will update the time stamp on the application and .pdb files, but the application will perform the way it did in earlier code versions, not the most recent code version that was running problem when I ran debug mode immediately after pressing Ctrl + F5.
These are C# Console Apps with the .NET Framework 4.6.1, if that makes any difference. I checked the output folder, and it is indeed the desired folder and the one I have been looking in... so why is the time stamp updating on the application (.exe file) that it outputs, but not the code itself? What am I missing?
When I run into strange things like this in Visual Studio, the first thing that usually works is to clean the project and rebuild. If that doesn't work, I'll close Visual Studio, re-launch, then clean and rebuild again. If that doesn't work, I would start looking into any extensions you have installed that might be getting in the way of your build process.
Further, you can look into logging the extensions activity to help troubleshoot if there are issue there. See the following article:
https://blogs.msdn.microsoft.com/visualstudio/2010/02/24/troubleshooting-extensions-with-the-activity-log/
You may have already tried this, but since it wasn't mentioned I thought I'd provide it for others in a similar situation.
Two possible reasons:
(1) Your project was not recompiled during debugging. Please enable Edit and Continue under TOOLS->Options->Debugging.
(2) Visual Studio has a concept of incremental build. If you have a solution with two or much more projects and if you change source code in only one of the two projects, the "Build" command will compile only the modified project. But the "Rebuild" command, on the other hand, it will recompile all projects in this solution.
I have a solution which contains 5 C# projecst, 2 wix projects and a C project (2010). We have been developing this in VS2013 Ultimate and all has been fine. I've just tried opening the solution in VS2015, I have no errors, and no warnings. When I press the start button (F5), nothing happens. I don't even hit the first line of the Program.cs file. All it seems to do is build the project. Any ideas?
EDIT
The same project was open in both VS2013 and VS2015 at the same time as I was comparing config etc.
When I closed down VS2013, the program ran!
Not entirely sure why this occurred...
Yes the problem is indeed with running the same project in both Visual Studio 2013 and 2015 at the same time.
When you start the program, only the version of VS which was opened first will be able to run the program. This is because the first opened VS attaches the vshost.exe process to the project and denies any access to that exe, which is why the last opened version fails to attach its own vshost.exe. Thus it stops after building the solution.
The same project was open in both VS2013 and VS2015 at the same time as I was comparing config etc.
When I closed down VS2013, the program ran!
Not entirely sure why this occurred...
I wrote a WPF application in C# using VS 2010. The application will run fine in debug mode using Visual Studio, but when I go to run the .EXE from the bin\release folder, nothing happens. I do not get any error messages from windows and there are no errors or warnings in VS. I have tried to build, rebuild and clean the solution (in every possible order) with no luck. My solution contains 2 projects, both of which use .NET 4.0 framework, and I have .NET 4.0 installed on my PC. I have tried on both XP and Win7 and still nothing.
I also just noticed that the output from Debug when I run the application in debug mode says: "Cannot find or open the PDB file" after each .Dll it loads.
I am compiling to the Release folder every time, but i did try changing it to the debug folder and clean/rebuild just to see if that would make a difference, and it didnt, so I changed it back, tried it again, and still nothing.
Any Ideas?
Here are a couple of ideas that come to mind
If you are on a x64 machine, try changing the application from being AnyCPU to x86. This the mode that applications default to in debug mode and it's possible an issue running in x64 is causing a problem in release builds
Possible the Release binaries are out of date. Delete the binaries from the Release folder, rebuild and run the newly generated runs
Run the release build under the debugger in Visual Studio and see if it till crashes
I was experiencing the above issue too, however none of the other solutions worked for me.
My Application logs in Event Viewer listed event ids 1018 and 1022. This appeared to be bizarrely related to an ASP.NET 2.0 dll (bizarre; as this was a blank WPF project only). The logs contained messages like this:
Windows cannot open the 64-bit extensible counter DLL
ASP.NET_64_2.0.50727 in a 32-bit environment
In the end it turned out to be resolved when I disabled my anti-virus. I had read that this resolution worked for someone with McAfee; and it also worked for my environment, which has Avast.
I assume you tried on a machine that doesn't have visual studio installed, and also none of the components you are using for development.
You have only one option: start the application with a debugger on the machine that causes problems and check for exceptions there. (use WinDBG for example - it's light and easy).
This looks like a problem with missing dependencies, but might be something else also.
The Debugging Labs should give you enough information on how to use windbg to find your problem:
.NET Debugging labs
Also use this:
WinDBG Cheat Sheet
(JaredPar) answer looks right (x64), but if not try right clicking on the EXE and running in admin mode for win 7.
I had a very similar issue.
Check out this setting on your App Pool entry:
Go to Advanced Settings.
Change 'Enable 32-bit Applications' to 'TRUE'.
This worked for me!
I'm going to go with a wild guess that:
Either you have some odd corruption in your .NET Framework installation
There is some debug/release-specific code using #if DEBUG or the such that is substantially different to cause issues.
You have not compiled recently into Release yet (Try changing it to Release before compiling your latest code and make sure you get no errors).
Those are the only things I can think of off the top of my head.
I had run into a similar issue, I was missing a custom folder in the release mode I was referencing in the constructor. Adding the folder to the release fixed the problem.