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

Config GUI: CA cert file chooser freezes the window #25

Closed
bpintea opened this issue Oct 9, 2018 · 3 comments
Closed

Config GUI: CA cert file chooser freezes the window #25

bpintea opened this issue Oct 9, 2018 · 3 comments
Assignees
Labels

Comments

@bpintea
Copy link
Collaborator

bpintea commented Oct 9, 2018

Pressing the "Browse.." button to open the file chooser will make the window unresponsive.
Likely connected to the threading apart. model.

@bpintea bpintea added the >bug label Oct 9, 2018
@codebrain
Copy link
Contributor

Correct.

The binding DLL needs to ensure that the form is created with a single threaded apartment model. The Open File dialog and the Trace File dialogs both rely on using a message pump loop in an STAThread.

https://docs.microsoft.com/en-us/dotnet/api/system.stathreadattribute?redirectedfrom=MSDN&view=netframework-4.7.2

Apparently if the thread is in a multi threaded apartment that is where you see the problem of the crashing dialog window.

So, how to fix? I remember you mentioned that you decorated the "main()" entry point into the form with the [STAThread] attribute and that didnt work - it might be worth looking into the binding C++ files to see if you can create the .NET call in an STAThread.

Failing that I can attempt to create another thread within the C# as an STAThread and attempt to run that...

@bpintea
Copy link
Collaborator Author

bpintea commented Oct 11, 2018

Fixed by bpintea@542bfff.

@bpintea bpintea closed this as completed Oct 11, 2018
@bpintea
Copy link
Collaborator Author

bpintea commented Oct 14, 2018

The current solution doesn't work if client application invoking the GUI had set already the threading model (to presumably MTA).

@bpintea bpintea reopened this Oct 14, 2018
@bpintea bpintea self-assigned this Oct 14, 2018
@bpintea bpintea closed this as completed Oct 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants