You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[EDIT] This problem appears only in debug mode, without attached debugger / in release mode it works as expected. VS2022
Hi, I have made the following observation when using HostObjects:
In my application, I am executing native code in C# through a JS call. The corresponding method opens an OpenFileDialog on the C# side, a file can be selected and you get the path back - so far it works quite well.
Now, if I don't make any selection in the dialog and just do nothing, after a few seconds (around 10s) the whole program terminates and dies.
Apparently the waiting Promise on JS side causes this crash?
Since my customers are sometimes "a bit slow" in selecting their files, or will spend a long time searching in their folders, of course the 10 seconds are not enough here.
Is there any explanation for this phenomenon or any way to stop this behavior?
JS-Side
// I have omitted all checks for clarity to show the basic problemclassDotNet{staticSelectJobFile(){returnwindow.chrome.webview.hostObjects.dotnet['SelectJobFile']();}}// ...the method will be called later in an asyncronous functionletfilePath=awaitDotNet.SelectJobFile();
C#-Side
// instance is registered as "dotnet" in webviews hostObjectspublicclassUIDotNetInterop{publicstringSelectJobFile(){OpenFileDialogopenFileDialog=newOpenFileDialog();if(openFileDialog.ShowDialog()==true){Debug.WriteLine(openFileDialog.FileName);returnopenFileDialog.FileName;}else{return"";}}}
This discussion was converted from issue #2803 on October 10, 2023 18:12.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
[EDIT] This problem appears only in debug mode, without attached debugger / in release mode it works as expected. VS2022
Hi, I have made the following observation when using HostObjects:
In my application, I am executing native code in C# through a JS call. The corresponding method opens an OpenFileDialog on the C# side, a file can be selected and you get the path back - so far it works quite well.
Now, if I don't make any selection in the dialog and just do nothing, after a few seconds (around 10s) the whole program terminates and dies.
Apparently the waiting Promise on JS side causes this crash?
Since my customers are sometimes "a bit slow" in selecting their files, or will spend a long time searching in their folders, of course the 10 seconds are not enough here.
Is there any explanation for this phenomenon or any way to stop this behavior?
JS-Side
C#-Side
Beta Was this translation helpful? Give feedback.
All reactions