Visual studio debugging starts but application doesn't - winforms

So, the problem that I am having is that when I push F5, or click Start, Visual Studio starts debugging, but the application doesn't actually build. If I go to my Task Manager, and look for the process it isn't there. Or, if I alt-tab between the programs I had open. I have had this problem twice now. The last projet I started, I encountered this problem. I spent days looking for answers on my time off but couldn't find anyhting. So i started a new project. And now I'm getting the same thing. If I go to my source tree and go back to a previous build and discard my changes, it works fine. But the problem comes back. Its not my coding. I am not getting any build errors. And I don't have any break points. So i can't hit continue. PLease alos note, that between it working, and not working I have not changed ANY setings in Visual Studio. I will post what I have tried. If I forget anything, please forgive me. I have days and days of history to go through in my browser.
Restarted Computer and VS
Ran VS in Admin
Always Build is selected in Tools -> Options -> Projects and
Solutions -> Build and Run
Make sure project is set to Debug in Solution Configuration and
Build is checked in Configuration Manager.
Make sure Only BUild startup projects and dependencies on run is
unchecked
Clean Solution
Unchecked Enable the Visual Studio hosting process in Project ->
Properties -> Debug tab
Made sure vshost32.exe was not running in the background while
program was not running in the Task Manager.
Deleted contents of bin and obj files in my project folder file and
reset computer.
Tried running the program from the exe in previously mentioned
bin/obj file. (The last one does start the process in Task Manager. But still doesnt show in the task bar, or alt tab.)
None of these have worked. I am getting very frustrated at this. Maybe I am not looking for the right thing in Google...

I suggest you close all third party tools/processes like the Anti-virus or others, and then re-debug it.
Or
You could run your VS in safemode:
devenv /SafeMode
Some community members found that the symbols loaded is really slow recently, and this issue has been report the Microsoft product team, so please also disable the Microsoft symbols server under TOOLS->Options->Debugging->Symbols. Debug it again.

Related

Visual Studio Code opens multiple instances

Two days ago I installed Visual Studio Code and it worked pretty fine. But now as I am opening Visual Studio Code it's opening multiple instances, how can I solve it..??
Edit: it seems Visual Studio Code opens every file present in the directory in another window how can I solve that..??
I had similar problems as well (SECOND ACTION - in my answer should solve your problem). My system was suddenly "laggy" as well, with no prior sign of significant damage. My windows self-restarted on its own, attempting to fix the problem but still didn't resolve it. When I use the command:
code .
in the comand line to open a folder in visual studio code (vscode) editor, it opens multiple instances of windows tab. Below is how I tackled the two problems:
Two things (Actions);
FIRST ACTION: (targeted: Laggy windows OS)
I used the command prompt(in Admin mode) to run the command: ”
sfc /scannow
This action fixed some corrupt system file and solved the laggy nature. I noticed significant improvement, possibly restoring it to previous performance level.
Check the Microsoft docs for more info.
SECOND ACTION: (Visual Studio Code opens multiple instances - should answer your question)
Open vscode editor, go to the setting and paste this in the search bar:
"workbench.editor.enablePreview": false
If you have this option marked, you should unmark it or set it to false depending on the interface you are presented and interacting with. This should stop vscode from running multiple instances and hopefully resolve your problem.

Issue Signing xap file in post build event on TFS Build

We have a silverlight(5) project, the source in TFS (2010) and Continuous Integration build has been setup and working fine. However, we are now at the stage where we are trying to release it to some users to get them using it and give feedback. I've set up the code so that it checks for updates and if there are any it downloads the latest xap file. However this requires the xap file to be signed. No problem when doing this from our dev machines, but when it comes to the automated build it fails, with the message
Xap packaging failed. Cannot locate the signing tool SignTool.exe.
I've tried numerous things to get the signtool to be recoginised and can't. However, we don't actually need this on the CI build, so I've then tried a second tack which is to make the postbuild event conditional on being run in VisualStudio. Followed various suggestions here on SO but can't gett them to work.
The post build event is
if "$(BuildingInsideVisualStudio)" == "true" (
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\signtool.exe" sign /f "$(SolutionDir)castle.pfx" "$(TargetDir)Castle.xap"
copy "$(TargetDir)Castle.xap" "$(SolutionDir)Castle.Web\ClientBin"
)
still no joy. Have tried multiple variations of this, but keep getting the same message from the automated build.
So can anyone help with either a) getting the signing tool to be recoginised on the build server or b) getting the automated build to skip the postbuild event?
Found the problem in the end...
I had been putting in place some features so the app would download and install the latest xap file. This requires it to be signed. As this wasn't working I followed some instructions on signing a xap file, not realising that one of the other developers here had put in place the code I described above in the post build event.
I had mistakenly thought that this was created as a result of me checking the 'Sign The Xap File' check box.
So first issue was that other developer had not shared his pfx file with us to add to our certificate stores.
Second, and main issue, was that we then had two attempts at signing going on. The one via the check box and the one via the post build event. I removed the check box and it worked fine.
The issue with the check box is that it expects the SignTool.exe to be in a particular location. On our development boxes with full VS it is where it is looking for it, but on the build server it wasn't. Think it may also have something to do with 64bit machines.
By using only the build event (once you have the correct certificates installed) you can specify explicitly the location that the signtool is going to be, and if necessary install the windows sdk to that location.
This is the top result in Google for this error so updating it with my steps to resolve.
The above didnt work for me but performing the steps below should fix it.
Install the Windows 8.1 SDK on the build server (Windows 2008 R2 for me)
Adding the Windows SDK BIN directory (that contains signtool.exe, on my server) to the Environment PATH variable - e.g. c:\program files (x86)\Windows Kits\8.1\bin - note: Do not add quotes around this
Restart all the Visual Studio Team Foundation services in services.msc after you add the file path to the PATH variable as it needs to reload these before building

IIS related System.ExecutionEngineException

After too many hours of research I have come up with nothing to solve this problem.
I am running a WPF program in an .xbap page file being hosted on internet explorer. Running the project in Visual Studio 2010 works just fine and generates no errors.
I want to be able to host the webpage on IIS 7.0 and to browse to it with a windows forms application. To test this I created a new website on port 80 in IIS manager. I then published the project to the local website folder and added the autogenerated project certificate file (projectName_TemporaryKey.pfx) to my Trusted Publishers and Trusted Root Certification Authorities.
My problem is this: whenever I try to browse to the file with internet explorer or with my windows forms program, the wpf program stops working. When pulling up the just-in-time debugger, I am informed that there is a System.ExecutionEngineException but am given no source code, no stack trace, and no data outside of an empty Dictionary enumerable. My guess is that this might have something to do with the database call made in the program to another machine, but I can't prove that.
I've tried several things to solve this including repairing my .NET 4.0 framework and altering permissions but nothing seems to be affect the error.
Does anyone know of a way to get more information on this error, or perhaps a step I may have missed when publishing this project?
Thanks very much.
Some things to check:
Windows event log often includes additional exception information (although usually in an awful format)
Output some trace information from your application so you can follow what's happening
Try attaching a debugger to the WPFHost and then stepping through the code

Visual Studio 2010 Ultimate Publish Problem

I have a WPF C# 4.0 Application. I was publishing projects fine before but all of a sudden one particular project starts to not publish. I get the following errors after a successful build.
Error 2 Could not find file 'obj\x86\Release\CSCDemo.exe'. CSCDemo.0
Next error is 'failed to Publish'
I know that CSCDemo.exe is in the Release folder because I checked.
Would Microsoft Visual Studio 2010 Service Pack 1 fix this?
The packager is looking at the obj\x86 folder, not the normal bin\release folder for your exe. I am thinking the issue has to do with either the packager looking in the wrong place or you have changed the project properties for your CSCDemo project. Have you changed it from being an x86 application to x64?
Another thing to try would be a complete rebuild.
I have just suffered from this problem. It seems my Avast Anti-Virus was deleting the file as soon as it was created. I just added my project folder to it's global exclude list and everything worked fine again.
I'm not sure exactly how your development machine can get fouled up this way, but this started happening for several developers in our group too.
After researching it, it appears that the built in build/publish script that Visual Studio (2010 in our case) uses has a flaw in the order that it does things. Most importantly it runs a cleanup on the OBJ directory deleting the target EXE file before the publish step can grab it.
The solution
This is somewhat of a hacky workaround, but it solved the problem for me.
The fix is to copy the file back to the /obj/ folder from the /bin/ folder right before the publish step. Unfortunately there is no way that I know to specify a BeforePublish event through the IDE, so you will have to edit the .vbproj file in a text editor.
Add the followign section just before the final </project> tag.
<Target Name="BeforePublish">
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(IntermediateOutputPath)" />
</Target>
change the platform from x86 to Any CPU will help
Build>configuration manager
change the platform against CSCDemo to Any CPU

System.OutOfMemoryException and a few exceptions happen during application run, Visual Studio 2010 WPF C#

I just discovered this problem today, and I had no idea what caused this problem. My project had been developed for few months.
I have a project(solution), with several projects in there, it works well if I write and debug, by pressing F5.
The problem occur is when I press Ctrl+F5 (to skip debug mode), or run directly from double click the exe, it crashed. The errors dialogs that pop up every times are different, but OutOfMemoryException is the most frequent one.
I had checked to make sure all my projects are .Net 3.5
I put a MessageBox.Show("something") at the beginning of my main project constructor, but it never reach.
I use some registry cleaner to clean/fix my registry, scan for viruses.
I had try to read the meaning of each error and exception, but still no clue why it happen.
These are a series of screenshots if I press Ctrl + F5. (FutureGenerator is some random name I gave to my project.)
Series of screenshot if I run the app from my debug folder, FutureGenerator.exe
I suspect this is caused by framework crashed during Windows Update, but I removed those update that I performed recently, still same. The exe file works on other non development PC, but I don't want to reformat my PC or reinstall my VS, yet, because it's a painful process.
Any idea, anyone?? Million thanks.
You mention v3.5 but the very first screenshot is about v4.
Try repairing your Framework 4 and/or VS2010
I found the problem. It's actually because I added FutureGenerator.exe into Application Verifier by Microsoft. The verifier only support debugging testing.
After I removed FutureGenerator.exe from the Application Verifier, everything's ok.

Resources