Open Buddha1996 opened 4 years ago
Hi @Buddha1996 can you let me know the details of the crash you got?
I am able to use StartProcess
without issues (for example, in the example application). Would be great to know why it doesn't for you!
Hello @dwmkerr , I've managed to rebuild the problem (found an older build from me) and gather some information. Beside it, I got another strange and interesting point.
General Information: Targetted Framework is .Net Framework 4.7.2, your ConsoleControl.WPF nuget package is in the version 1.2.1
Excuse me, my VS2019 is in german so I will translate it.. Error thrown is:
Ein Ausnahmefehler des Typs "System.InvalidOperationException" ist in WindowsBase.dll aufgetreten. Der aufrufende Thread kann nicht auf dieses Objekt zugreifen, da sich das Objekt im Besitz eines anderen Threads befindet.
Exception type "System.InvalidOperationException" occured in WindowsBase.dll. The calling thread can't be opened because it's in control of another thread.
System.InvalidOperationException HResult=0x80131509 Nachricht = Der aufrufende Thread kann nicht auf dieses Objekt zugreifen, da sich das Objekt im Besitz eines anderen Threads befindet. Quelle = WindowsBase Stapelüberwachung: bei System.Windows.Threading.Dispatcher.VerifyAccess() bei System.Windows.DependencyObject.GetValue(DependencyProperty dp) bei ConsoleControl.WPF.ConsoleControl.get_ShowDiagnostics() bei ConsoleControl.WPF.ConsoleControl.processInterace_OnProcessExit(Object sender, ProcessEventArgs args) bei ConsoleControlAPI.ProcessInterface.FireProcessExitEvent(Int32 code) bei ConsoleControlAPI.ProcessInterface.currentProcess_Exited(Object sender, EventArgs e) bei System.Diagnostics.Process.OnExited() bei System.Diagnostics.Process.RaiseOnExited() bei System.Diagnostics.Process.CompletionCallback(Object context, Boolean wasSignaled) bei System.Threading._ThreadPoolWaitOrTimerCallback.WaitOrTimerCallback_Context(Object state, Boolean timedOut) bei System.Threading._ThreadPoolWaitOrTimerCallback.WaitOrTimerCallback_Context_f(Object state) bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) bei System.Threading._ThreadPoolWaitOrTimerCallback.PerformWaitOrTimerCallback(Object state, Boolean timedOut)
It's getting even more curious.
I just created a simple test wpf application and implemented the console the same way as in my main application (the build where the error occured). and it worked (in the new test app) .. So i don't really get exactly what the problem causes. Maybe my project is a little bit too large and I miss something.
It's always called this way for example:
ConsoleName.StartProcess("cmd.exe", "");
Mostly I used to start self written console applications^^
As above mentioned, my project is now fine so this has no hurry. :D
But what me wonders is the following thing. I downloaded your source binaries and if I opened your code everything was fine.. IntelliSense didn't highlight anything.
But at the moment I copied the ConsoleControl.WPF code to my usercontrol and made the changes which had to be done to get this working... it highlighted an error on the above described position in StartProcess. So.. that's why I had opended this issue..
Well if I find a reason why this happens I will let you know! :)
Best wishes and have a fine weekend Julian
Hello, I really appreciate your work and used it in WinForms for a few months. After I switched to WPF, i had the problem that if I used
StartProcess(filename, arguments)
my application always crashed. So I reviewed your code last night and found the problem in the classConsoleControl.WPF/ConsoleControl.xaml.cs.
Inside your method
public void StartProcess(ProcessStartInfo processStartInfo)
you have the statementprocessInterface.StartProcess(processStartInfo);
.I had to change this statement to:
processInterface.StartProcess(processStartInfo.FileName, processStartInfo.Arguments);
After this change ConsoleControl run's fine in my WPF project without any errors. So if anyone is still searching for a solution - here it is.
Best regards