Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 days ago.
Improve this question
I am currently working on a project and I need to retrieve a environment variable. I am doing the lines below to retrieve the environment variable but it doesnt do what I am expecting it to do.
string test = Environment.GetEnvironmentVariable("test1")
This line of code is suppose to retrieve an environment variable when its set before running a program but I tested to find out that this line of code is setting it and I did double check this in the system environment variables.
I run administrator command prompt and run a script to attach the entire program with a certain process I need to debug. This script will allow me to debug and run the entire UI. Then I run devenv.exe to launch visual studio 2015 and build the project. Now I go into environment variables and set the variable so it can be picked up by the line of code but this doesnt happen.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
A quick question here lads, cannot run a visual studio project on another machine, receiving the CLR20r3 System.IO.DirectoryNotFound. The thing is that it has all resources needed inside the exe itself, and it's launching perfectly for me, both on debug and release versions, while crashing on any other machine. What can it possibly mean? Tried creating an installer, of course, same result. Works for me, doesn't work for others.
Thanks in advance.
Looks like the directory that you are trying to find is not present on the other machine.It would be hard to find and fix this error without knowing from where exactly the exception is thrown. Better add a try catch and log the exception somewhere like a text file or a remote database. Once you are able to get hold of the line where the exception is thrown and the actual exception, it would be lot easier to fix it. Hope it helps.
A silly mistake with not uploading properties with the project. And some weird problem with custom font, had to refer to it from properties directly. Case closed.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I'm trying to make a program, which can open other programs, but I need help, because if I run a program, with
Process.Start(ExePath)
I get errors like 'cannot find 'File.*' file'.
but normally the program works when I start it manually it just works normally
does someone knows how to fix this?
Thanks in advance
You can build a full qualified path starting from your current application directory like this:
string exepath = Path.Combine(Environment.CurrentDirectory, "Games", "Game.exe");
Process.Start(exepath);
adopted from Specifying a relative path
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
Today I run into a strange error.
When I start my program without Visual studio 2010 Express, start to running, but the gui not appear, and inpossible do stop it in task managger.
But if I run it in Visual studio, it work without any problem.
It do it with my all c# program,even what I write years before, but not any other program.
Tried to check, if a virus do it, but it can't find anything.
Operting system is Windows 7
It can be antivirus who stops execution of your application. Try to turn off it.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
i am currently developing an alternate shell for windows( to be replaced with explorer).
the problem is the program runs fine when run as a normal executable.
but when i set it as default shell for windows and re-log in into my user account the program runs for a few seconds and then it force closes.
is there anything i can do what might be going wrong?
BTW working on c# wpf.
You are always debugging a compiled program.
However, when you run it from Visual Studio, the debugger is automatically attached (so you can see exceptions, set breakpoints, etc).
You can do the same thing to an already running process by using the "Attach to Process" option in the "Debug" menu.
Other things to try:
Add try/catch blocks around areas that can blow up
Add logging, especially to the try/catch blocks
Put a "sleep" at startup if the program closes before you can attach the debugger.
Also, from #ScottChamberlin, you can directly ask that a debugger be attached from the running executable via System.Diagnostics.Debugger.Launch().
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I am sharing a C# project with a colleague so I have moved the entire folder containing the project to his PC. He are both running VS 2012. Anyway when opening the solution we get an error.
All the classes still have the path of the origin PC so when trying to run on the other one it is not able to find the class.
I don't know why this is happening. I want to use the classes in the folder not the ones in the origin PC. Even if they are exactly the same we don't have access to that PC now.
How can I fix this and tell VS to use the classes in the folder I have moved to the new PC?
EDIT
I have fixed the path so it is using the ones in the correct folder.
The main function is:
class MainClass
{
public static void Main()
{
myInputForm myInputForm1 = new myInputForm();
myInputForm1.ShowDialog(); // show interface to prompt user...
}
}
The error that occurs when the ShowDialog() method is called is:
An unhandled exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll
Additional information: dragdrop registration did not succeed.
If you open up your .csproj files in Notepad, you can edit the file paths directly. Generally you want to use relative paths rather than absolute paths so you don't run into this problem.
To see the difference between relative and absolute paths, look at the code examples in Which one is correct approach for assembly reference in csproj file?.
Make an account on Visual Studio Online for TFS Source Control and manage your project in source control. It is free for up to five users. Then you can share the project and both have copies of the source code.