Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug ZipExtractor Project Error #711

Open
oufu99 opened this issue Sep 26, 2024 · 7 comments
Open

Debug ZipExtractor Project Error #711

oufu99 opened this issue Sep 26, 2024 · 7 comments

Comments

@oufu99
Copy link

oufu99 commented Sep 26, 2024

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
Copy link
Author

oufu99 commented Sep 26, 2024

ErrorInfo:
image
Version:
image

@ravibpatel
Copy link
Owner

Can you try replacing that line with following one?

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

@oufu99
Copy link
Author

oufu99 commented Sep 27, 2024

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?

@ravibpatel
Copy link
Owner

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
Copy link
Author

oufu99 commented Sep 29, 2024

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
Copy link
Author

oufu99 commented Sep 29, 2024

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

@ravibpatel
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants