OfficeDev / Office-Add-in-samples

Code samples for Office Add-in development on the Microsoft 365 platform.
MIT License
709 stars 783 forks source link

DotNet.invokeMethodAsync function disabled with .NET 7 RC2 and 8 p5 in a Blazor addin project #544

Closed RaoulRSV closed 11 months ago

RaoulRSV commented 1 year ago

URL of sample

_URl :https://github.com/RaoulRSV/excel-blazor-add-in_NET7.0

Describe the bug

Enabling RC2 disables DotNet.invokeMethodAsync function in a "Blazor addin" project Edit : I test it also with .NET8.0 pr v5 and I got the same bug wxith a "uncaught reference error : sharedarraybuffer is not defined". Please note that I am using Chrome and Visual Studio 17.7 p2

To Reproduce

Steps to reproduce the behavior:

  1. open sample here
  2. run sample with NET 7.0.
  3. Click twice on "ouvrir" ribbon button
  4. check in console message : "fin lancé : 1,2,3" after "lancerchaîné30"
  5. in csproj enable : WasmEnableThreads

Expected behavior

_run again : message "fin lancé: 1,2,3" has disappeared (after 2 click on "ouvrir" button") showing that DotNet.invokeMethodAsync function is disabled Screenshots

If applicable, add screenshots to help explain your problem.

Environment

Additional context

Note that sample is based on "Blazor addin" for which unexpectedly C# break point are not available : see [https://github.com/OfficeDev/Office-Add-in-samples/issues/535]

pinverso commented 1 year ago

@aafvstam , this might be similar to this issue: https://github.com/OfficeDev/Office-Add-in-samples/issues/512

RaoulRSV commented 1 year ago

This issue seems to apply on all wasm blazor project, be it addin or not. See #548 I suggest this issue to be merged with #548

RaoulRSV commented 1 year ago

as mentioned in #548. I finally understood that multithreading is still not available for blazor, be it with .net 7.0 rc2 or .NET 8.0 preview. I did misinterpret the blogpost on experimental multithreading. It is about webworkers in plain javascript but seems to still have its own difficulties see https://github.com/dotnet/runtime/issues/68162. Thanks to @aafvstam I close this issue