Description
What happened?
I'm trying to get the full filesystem path of a FileSystemDirectoryHandle selected in the hosted web app. I followed the examples provided in the spec document.
#3706
Observed behavior:
The AddionalObjects Array on the receiving side is empty or contains null entries.
Expected behavior:
AdditionalObjects contains the corresponding WebView2 or FileSystem API objects
The customer context is the modernization of a legacy app. The scenario requires offline access to files retrieved via a legacy authentication system that requires native code. All business logic and file operations are implemented as a modern PWA. The use case that requires the shared FileHandles is about opening the local files in the installed desktop application (Word, Excel, PowerPoint)
Importance
Important. My app's user experience is significantly compromised.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
136.0.3240.50
SDK Version
1.0.2903.40
Framework
WinUI3/WinAppSDK
Operating System
Windows 11
OS Version
26100.3915
Repro steps
From Web to Native
JS code
const dirHandle2 = await window.showDirectoryPicker({ mode: "readwrite" });
const fileHandle2: FileSystemFileHandle = await dirHandle2.getFileHandle(this.doc!.name, {create:true});
const additionalObjects:ArrayLike<object> = [dirHandle2, fileHandle2];
(<any>window).chrome.webview.postMessageWithAdditionalObjects ("getdldir", additionalObjects);
CS code
private void CoreWebView2_WebMessageReceived(CoreWebView2 sender, CoreWebView2WebMessageReceivedEventArgs args)
{
var firstObject = args.AdditionalObjects[0];
//is null
}
From Native to Web
JS code
(<any>window).chrome.webview.addEventListener('message', async (arg:any) => {
console.log(arg);
//additionalObjects is an empty array
}
CS code
var fsHandle = AppWebView.CoreWebView2.Environment.CreateWebFileSystemDirectoryHandle("C:\\...\\App Docs", CoreWebView2FileSystemHandlePermission.ReadWrite);
var fsHandle2 = AppWebView.CoreWebView2.Environment.CreateWebFileSystemFileHandle("C:\\...\\App Docs\\MFA is here.docx", CoreWebView2FileSystemHandlePermission.ReadWrite);
AppWebView.CoreWebView2.PostWebMessageAsJson("{\"test\" : 0}", new List<object> { fsHandle, fsHandle2} );
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
No, this never worked
Last working version (if regression)
No response