ravibpatel/AutoUpdater.NET

Debug ZipExtractor Project Error

Opened this issue · 7 comments

oufu99 commented

I want to debug this project and then pass in the running parameters myself,I only modified this one place

 var str = @"--input C:\Users\Administrator\AppData\Local\Temp\NewClient.zip --output E:\Code\GPDI.Service.AutoUpdate\Service.AutoUpdater.NET\AutoUpdaterWinformTest\bin\Debug\net7.0-windows --current-exe E:\Code\GPDI.Service.AutoUpdate\Service.AutoUpdater.NET\AutoUpdaterWinformTest\bin\Debug\net7.0-windows\AutoUpdaterWinformTest.exe --updated-exe GPDI.Manager.Mike.Client.exe";
        string[] args = str.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);

I use Vs' Debug mode to run it, and it will report an error saying 'Invalid inter thread operation: it was never accessed by a thread that created the control' FormMain '.' However, if I directly run the exe in its bin directory, it will not report an error
image

oufu99 commented

ErrorInfo:
image
Version:
image

Can you try replacing that line with following one?

Invoke(new Action(() => { ControlBox = false; }));
oufu99 commented

Can you try replacing that line with following one?

Invoke(new Action(() => { ControlBox = false; }));

I just want to extend your source code and don't want to directly modify it. why the exe program can execute normally while in debug mode. Do I need to change which setting of Vs to avoid errors.
If modifications are necessary for debugging, would there be any flaws in the design? Would it be better for the author to directly modify it to use Invoke mode?

It should work both in Debug and Release mode without any modification. It works on my end without any modifications. This error can happen when trying to change UI from background thread. If that code works for you, I can add it to the original source code.

oufu99 commented

It should work both in Debug and Release mode without any modification. It works on my end without any modifications. This error can happen when trying to change UI from background thread. If that code works for you, I can add it to the original source code.

Only the code in this area has been modified, but the program still cannot work correctly. To describe my problem in detail, I recorded three videos.
1.In first.mp4, I showed the location of the source code modification, with the aim of debugging ZipExtractor directly using Visual Studio's Debug mode without requiring the client to invoke the program. After running, ControlBox=false; This position is reporting an error
2.In second. mp4, I modified this code to Invoke (new Action()=>{ControlBox=false;});, When running again, this sentence no longer reports an error, but it still reports an error afterwards
3.In Three.mp4, I directly call the. exe format generated by debug mode, which can run correctly

The code I have modified:

  var str = @"--input C:\Users\Administrator\AppData\Local\Temp\NewClient.zip --output E:\Code\GPDI.Service.AutoUpdate\Service.AutoUpdater.NET\AutoUpdaterWinformTest\bin\Debug\net7.0-windows --current-exe E:\Code\GPDI.Service.AutoUpdate\Service.AutoUpdater.NET\AutoUpdaterWinformTest\bin\Debug\net7.0-windows\AutoUpdaterWinformTest.exe --updated-exe GPDI.Manager.Mike.Client.exe";
  var splitList = str.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);

  //string[] args = Environment.GetCommandLineArgs();
  string[] args = splitList;
first.mp4
second.mp4
three.mp4
oufu99 commented

Finally, I made modifications to these two areas so that the program could be debugged correctly.
If the author thinks there is no problem, they can introduce it into the project to avoid others encountering my problem
111

222

Thanks for showing modifications you made. I will apply it to main project.