Tewr/BlazorFileReader

Page fails to open when used within a WebView2 (Photino) project

Smurf-IV opened this issue · 4 comments

Describe the bug
On page load I get the following, which then prevent the page from loading

"projectNamehere" Warning: 0 : Tewr.Blazor.FileReader.PlatformConfig.TryReadMaximumReceiveMessageSize: Unable to load type Microsoft.AspNetCore.SignalR.HubOptions`1, Microsoft.AspNetCore.SignalR.Core
"projectNamehere" Warning: 0 : Tewr.Blazor.FileReader.FileReaderService: Unable to read SignalR MaximumReceiveMessageSize, defaulting to 32768

To Reproduce
Steps to reproduce the behavior:

  1. Projects load correctly
  2. Click on on a Navbar which should then open a page for uploading
  3. Paged Does not open
  4. See error

Expected behavior
The App works as expected when the shared razor files are used in the CSB which is then client side hosted

Screenshots
Project type
CSB Photino.Blazor

Environment

  • Browser - Edge WebView2
  • Version of Blazor.FileReader - Latest
  • Version of .net sdk - Net 5.0.3
Tewr commented

Looks like a problem with platform detection. On the other hand, I doubt that System.Diagnostics.Trace.TraceWarning is causing your problem. it should not stop your project from running or there is a serious design flaw. Probably just a symptom. Something else is at a miss, still probably related to platform detection.

Could you upload a repro project? I'm not familiar with Photino. I'm guessing it is this library you are using?

Agreed about the TraceLines (See below)
It does not stop any other function ality, just the display of the page that has the usage of the IFileReader etc.
Correct library.

Note: Photino.Blazor has a problem with Console and Debug Writelines being captured either in VisStuidioo, or the "F12" equivalent, so I do not see any other output

Tewr commented

I get a page load, the page loads fine. As you didn't post any code, I don't know what you did wrong. However there are some other issues. The JSRuntime used here is apparently Photino.Blazor.DesktopJSRuntime. It does not deserialize ElementReference into an element instance -- I could not immediately understand why -- but in any case it is not compatible with the Blazor JsRuntime implementation. Instead I get an object looking like this {"id":"89fbcb62-9769-40bf-81bf-d4aa02359feb","context":null}

To support this I would have to add explicit support for their implementation. As it stands, it does not work with ElementReference, you would have to keep track of the elements yourself. I tried this and indeed I manage to read a file, but there was also some other error message popping up. So it would be better to open an issue on their tracker.

On a general note, I would not use <input type=file>, nor my component for this kind of deployment, it is way too slow. I would suggest to use a x-platform FilePicker instead (I think Xamarin.Essentials has one) to get a native stream, also you would have full access to the disk, and the stream would be writable. Or if your target is Ms Windows and not x-plat, just open use the native file picker on the click of a button.

Tewr commented

I'm closing this, feel free to reopen if theres anything to add to the discussion