Giter Club home page Giter Club logo

uno.wasm.bootstrap's Introduction

Uno.Wasm.Bootstrap

Open in Gitpod

Uno.Wasm.Bootstrap provides a simple way to package C# .NET code, and run it from a compatible browser environment.

It is a standalone .NET Web Assembly (Wasm) sdk bootstrapper taking the form of a nuget package.

Installing it on a .NET project (5, 6, 7 or .NET Standard 2.0) with an entry point allows to publish it as part of a Wasm distribution folder, along with CSS, Javascript and content files.

This package only provides the bootstrapping features to run a .NET assembly and write to the javascript console, through Console.WriteLine.

This package is based on the excellent work from @praeclarum's OOui Wasm MSBuild task.

Documentation

uno.wasm.bootstrap's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uno.wasm.bootstrap's Issues

Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0

I thought I'd give this library a go, but am struggling to get my project to build.

https://github.com/tboby/cwtools/tree/webasm

  1. cd ./CWToolsWebAsm
  2. dotnet run

Complications:

  1. The project is F#
  2. The project uses paket
  3. I'm not using VS but VS Code (although if it works from the CLI it shouldn't matter right?)
C:\Users\Thomas\.nuget\packages\uno.wasm.bootstrap\1.0.0-dev.225\build\Uno.Wasm.Bootstrap.targets(119,5): error : File name: 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' [C:\Users\Thomas\git\cwtools\CWToolsWebAsm\CWToolsWebAsm.fsproj]
C:\Users\Thomas\.nuget\packages\uno.wasm.bootstrap\1.0.0-dev.225\build\Uno.Wasm.Bootstrap.targets(119,5): error :    at Uno.Wasm.Bootstrap.ShellTask_v8c65fa35cd0641efbf4212521f852d43f268a3dc.GeneratePWAContent(StringBuilder extraBuilder) [C:\Users\Thomas\git\cwtools\CWToolsWebAsm\CWToolsWebAsm.fsproj]
C:\Users\Thomas\.nuget\packages\uno.wasm.bootstrap\1.0.0-dev.225\build\Uno.Wasm.Bootstrap.targets(119,5): error :    at Uno.Wasm.Bootstrap.ShellTask_v8c65fa35cd0641efbf4212521f852d43f268a3dc.GenerateHtml() in C:\agent\_work\1\s\src\Uno.Wasm.Bootstrap\ShellTask.cs:line 876 [C:\Users\Thomas\git\cwtools\CWToolsWebAsm\CWToolsWebAsm.fsproj]
C:\Users\Thomas\.nuget\packages\uno.wasm.bootstrap\1.0.0-dev.225\build\Uno.Wasm.Bootstrap.targets(119,5): error :    at Uno.Wasm.Bootstrap.ShellTask_v8c65fa35cd0641efbf4212521f852d43f268a3dc.Execute() in C:\agent\_work\1\s\src\Uno.Wasm.Bootstrap\ShellTask.cs:line 138 [C:\Users\Thomas\git\cwtools\CWToolsWebAsm\CWToolsWebAsm.fsproj]
C:\Users\Thomas\.nuget\packages\uno.wasm.bootstrap\1.0.0-dev.225\build\Uno.Wasm.Bootstrap.targets(119,5): error :  [C:\Users\Thomas\git\cwtools\CWToolsWebAsm\CWToolsWebAsm.fsproj]
C:\Users\Thomas\.nuget\packages\uno.wasm.bootstrap\1.0.0-dev.225\build\Uno.Wasm.Bootstrap.targets(119,5): error :  [C:\Users\Thomas\git\cwtools\CWToolsWebAsm\CWToolsWebAsm.fsproj]

If I use an older version (e.g. 204, 194), then it builds, but I get a Stackoverflow exception on run.

My project file:

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netstandard2.0</TargetFramework>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <TieredCompilation>true</TieredCompilation>
    <MonoRuntimeDebuggerEnabled>false</MonoRuntimeDebuggerEnabled>
  </PropertyGroup>
  <ItemGroup>
    <ProjectReference Include="..\CWTools\CWTools.fsproj">
      <Name>CWTools.fsproj</Name>
    </ProjectReference>
    <DotNetCliToolReference Include="Uno.Wasm.Bootstrap.Cli" Version="1.0.0-dev.224" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Main.fs" />
    <None Include="App.config" />
  </ItemGroup>
  <Import Project="..\.paket\Paket.Restore.targets" />
</Project>

Any ideas?

Cannot build AOT with existing instructions

Using the directions here you cannot build wasm AOT. Verified by creating test project that builds successfully using the above directions, and fails to build after updating to latest Uno.Wasm.Bootstrap.

WasmAotBuild.zip

To reproduce: using the directions, built the attached project. Update the attached project to the latest Uno packages, clean, and attempt to build again - it fails with the error ' The EMSDK version is not compatible with the current mono SDK. Install 1.38.43'

If you install EMSDK 1.38.43 with:

./emsdk install sdk-1.38.43-64bit
./emsdk activate sdk-1.38.43-64bit

Then you still receive the same error.

Threads not working in AOT

Current behavior

If Uno.Wasm.Threads sample builded in FullAOT mode - threads not working

FullAOT:

image
image
image

Interpreter:

image
image
image
image

Same behavior if .bc/.a file embedded in any execution mode.

Expected behavior

Threads are working in any execution mode

Steps to Reproduce

Build and run Uno.Wasm.Threads Sample in FullAot mode

Context (Environment)

Nuget Package(s): Uno.Wasm.Bootstrap, Uno.Wasm.Bootstrap.DevServer

Package Version(s): 1.3.0-dev.33

Affected platform(s):

  • WebAssembly

Visual Studio:
2019 (version: 16.6.0 Preview 5.0)

Browser:
Chrome Version 83.0.4103.61 (Official Build)

Uno.Wasm.Bootstrap.Cli is not compatible with netstandard2.0

Hello,

If i create a project using .Netcore library i can install Uno.wasm.Bootstratp.cli without any issue but not if I use the netstandard2.0 as describe in the documentation here https://github.com/unoplatform/Uno.Wasm.Bootstrap . The nuget install throw me an error saying Cli is only compatible with netcoreapp2.1. So if I now create a project with net core 2.1 the nuget install of the Cli is working.However it doesn't seem to function with dot net core as when i run F5 Chrome start and close really quickly.

The web server returned an error: (404) Not Found

WebException: The remote server returned an error: (404) Not Found.
	SampleWASMCode	.nuget\packages\uno.wasm.bootstrap\1.0.0-dev.1\build\Uno.Wasm.Bootstrap.targets(16,3): error : WebException: The remote server returned an error: (404) Not Found.	

Add bootstrapper support for top-level caching

Currently, only .clr files are versioned using a somehow unique path, but most of the top level files are not. This can cause issues with regards to different caching strategies and provide desynchronized files.

A change can be made to move all files to a versioned folder, keeping only the index file at the root.

uno-bootstrap.js does not load image source from app manifest during initProgress

Current behavior

uno-bootstrap.js does not load image source from app manifest during initProgress.

the line of code

const manifest = window["UnoAppManifest"];

always returns undefined as the initializeRequire function has not yet been called.

Expected behavior

the UnoAppManifest information needs to be initalized earlier

How to reproduce it (as minimally and precisely as possible)

  1. Define a splashScreenImage in appmanifest.js
  2. in browser dev tools, place a break point in initProgress function
  3. load the wasm web page and interrogate the value for manifest variable. it shows undefined instead of the correct json object.

Environment

Nuget Package: Uno.Wasm.Bootstrap

Package Version(s): 1.0.0-dev.302

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renderers for Xamarin.Forms
  • Windows
  • Build tasks
  • Solution Templates

Visual Studio:

  • 2017 (version: )
  • 2019 (version: )
  • for Mac (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

new to uno platform development - not exactly sure how to correct situation as it appears that initializeRequire shouldn't be called any earlier in the initialization process

BUG Unable to activate class in external assembly

When trying to activate an instance of a class that resides in an external assembly using Activator.CreateInstance, the runtime is unable to find the default constructor and throws a MissingMethodException.

I've published a repro project here.

Here's the exception I get when trying to do that:

System.MissingMethodException: Default constructor not found for type ClassLib.Container
  at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic, System.Boolean wrapExceptions) <0x1fe8be8 + 0x000b2> in <6d87f062f89b420d9d9f10c6c9364ecc>:0 
  at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean wrapExceptions, System.Boolean skipCheckThis, System.Boolean fillCache) <0x1fe88e8 + 0x0001e> in <6d87f062f89b420d9d9f10c6c9364ecc>:0 
  at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Boolean wrapExceptions, System.Threading.StackCrawlMark& stackMark) <0x1fe8738 + 0x0004c> in <6d87f062f89b420d9d9f10c6c9364ecc>:0 
  at System.Activator.CreateInstance[T] () <0x1fe8298 + 0x00044> in <6d87f062f89b420d9d9f10c6c9364ecc>:0 
  at ClassLib.Container.ActivateContainer () <0x1fe3988 + 0x00000> in <948ebc2d2cc8463085c4a1382a40e80d>:0 
  at UnoBootstrapRepro.Wasm.Program.Main (System.String[] args) <0x1f94a48 + 0x0001e> in <92c627e27d9940aa9be1569ec269da2e>:0 
  at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic, System.Boolean wrapExceptions) <0x1fe8be8 + 0x000b2> in <6d87f062f89b420d9d9f10c6c9364ecc>:0 
  at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean wrapExceptions, System.Boolean skipCheckThis, System.Boolean fillCache) <0x1fe88e8 + 0x0001e> in <6d87f062f89b420d9d9f10c6c9364ecc>:0 
  at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Boolean wrapExceptions, System.Threading.StackCrawlMark& stackMark) <0x1fe8738 + 0x0004c> in <6d87f062f89b420d9d9f10c6c9364ecc>:0 
  at System.Activator.CreateInstance[T] () <0x1fe8298 + 0x00044> in <6d87f062f89b420d9d9f10c6c9364ecc>:0 
  at ClassLib.Container.ActivateContainer () <0x1fe3988 + 0x00000> in <948ebc2d2cc8463085c4a1382a40e80d>:0 
  at UnoBootstrapRepro.Wasm.Program.Main (System.String[] args) <0x1f94a48 + 0x0001e> in <92c627e27d9940aa9be1569ec269da2e>:0 

InvalidOperationException: The SPA default page middleware...

I have downloaded a sample from your site's tutorial, opened it in VS (2019, everything from the "requirements" pages is installed via VS Installer), and when I tried to run a WebAssembly project, I got this in the browser:

InvalidOperationException: The SPA default page middleware could not return the default page '/index.html' because it was not found, and no other middleware handled the request.
Microsoft.AspNetCore.SpaServices.SpaDefaultPageMiddleware+<>c__DisplayClass0_0.<Attach>b__1(HttpContext context, Func<Task> next)
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Combine it with custom Mono.js and Mono.wasm ?

I am working on a similar nuget that enables Winforms but as of now I need to use my own mono.wasm and mono.js becuase I have additional static libraries linked to them.
This way I can no more bother with having build targets and etc. and just use your nuget

Custom logo doesn't appear

If I change the src-tag of the img element in the index file, the UNO logo is still displayed. (In the last stable version as in the pre-release)

image

image

wsl path problem

from windows VS 2019 16.6 p4

26>Downloading mono-wasm-34cccfa2fde to C:\Users\michael\AppData\Local\Temp\mono-wasm-34cccfa2fde.aot.zip 26>C:\Users\michael\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.29\build\Uno.Wasm.Bootstrap.targets(124,5): error : ninja: error: '/mnt/c/Program', needed by 'linker-in/Microsoft.AspNetCore.WebUtilities.dll', missing and no known rule to make it 26>C:\Users\michael\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.29\build\Uno.Wasm.Bootstrap.targets(124,5): error : System.Exception: Failed to generate AOT layout (More details are available in diagnostics mode or using the MSBuild /bl switch) 26>C:\Users\michael\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.29\build\Uno.Wasm.Bootstrap.targets(124,5): error : at Uno.Wasm.Bootstrap.ShellTask_v8c826016b29bb0ecf96d9d40afe0827b1760844f.RunPackager() in D:\a\1\s\src\Uno.Wasm.Bootstrap\ShellTask.cs:line 604 26>C:\Users\michael\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.29\build\Uno.Wasm.Bootstrap.targets(124,5): error : at Uno.Wasm.Bootstrap.ShellTask_v8c826016b29bb0ecf96d9d40afe0827b1760844f.Execute() in D:\a\1\s\src\Uno.Wasm.Bootstrap\ShellTask.cs:line 166

from build.ninja

build $appdir/$deploy_prefix/Blazor.Extensions.Storage.dll: cpifdiff $builddir/linker-out/Blazor.Extensions.Storage.dll build $builddir/linker-in/Microsoft.AspNetCore.WebUtilities.dll: cp /mnt/c/Program Files/dotnet/sdk/NuGetFallbackFolder/microsoft.aspnetcore.webutilities/2.2.0/lib/netstandard2.0/Microsoft.AspNetCore.WebUtilities.dll build $appdir/$deploy_prefix/Microsoft.AspNetCore.WebUtilities.dll: cpifdiff $builddir/linker-out/Microsoft.AspNetCore.WebUtilities.dll build $builddir/linker-in/Microsoft.Net.Http.Headers.dll: cp /mnt/c/Program Files/dotnet/sdk/NuGetFallbackFolder/microsoft.net.http.headers/2.2.0/lib/netstandard2.0/Microsoft.Net.Http.Headers.dll build $appdir/$deploy_prefix/Microsoft.Net.Http.Headers.dll: cpifdiff $builddir/linker-out/Microsoft.Net.Http.Headers.dll build $builddir/linker-in/Microsoft.AspNetCore.Blazor.HttpClient.dll: cp /mnt/c/Users/michael/.nuget/packages/microsoft.aspnetcore.blazor.httpclient/3.2.0-preview3.20168.3/lib/netstandard2.0/Microsoft.AspNetCore.Blazor.HttpClient.dll

Package Uno.Wasm.Bootstrap.Cli is not compatible with netcoreapp2.2

When building with the 1.1 branch of the bootstrapper, the following error may appear:

Package Uno.Wasm.Bootstrap.Cli 1.1.0-dev.445 is not compatible with netcoreapp2.2

This is caused by the fact that Uno.Wasm.Bootstrap projects use the netstandard2.0 target framework, which implies that DotnetCliToolTargetFramework defaults to netcoreapp2.2.

The bootstrapper now requires .NET Core 3.1 to support the debugger, but there is no implicit way for specifying a default DotnetCliToolTargetFramework to be used during a clean nuget restore.

Workaround

In the csproj, add the following property:

<DotnetCliToolTargetFramework>netcoreapp3.1</DotnetCliToolTargetFramework>

Failed to download mono wasm SDK during build

When creating an Uno app in Visual Studio, and building de related Wasm project, I get an error that the download of the mono wasm SDK failed.
1>UnoApp.Wasm -> C:\Users\xxx\source\repos\UnoApp\UnoApp\UnoApp.Wasm\bin\Debug\netstandard2.0\UnoApp.Wasm.dll
1>Downloading mono-wasm-f07691d5125 to C:\Users\xxx\AppData\Local\Temp\mono-wasm-f07691d5125.zip
1>C:\Users\xxx.nuget\packages\uno.wasm.bootstrap\1.0.0-dev.58\build\Uno.Wasm.Bootstrap.targets(33,3): error : InvalidOperationException: Failed to download the mono-wasm SDK at https://jenkins.mono-project.com/job/test-mono-mainline-wasm/label=ubuntu-1804-amd64/598/Azure/processDownloadRequest/598/ubuntu-1804-amd64/sdks/wasm/mono-wasm-f07691d5125.zip
1>C:\Users\xxx.nuget\packages\uno.wasm.bootstrap\1.0.0-dev.58\build\Uno.Wasm.Bootstrap.targets(33,3): error :

Running Visual Studio as administrator didn't help. Downloading the zip file through a browser is not a problem.

Error coexisting Uno.Wasm.Bootstrap & WebAssembly.Bindings NuGets

  1. Create a new empty project with latest Uno.Wasm.Bootstrap preview
  2. Add a reference to WebAssembly.Bindings (0.2.2, you'll need to have it locally, but you already know this :-P)
  3. Build!

I expect a successful build; however, I get the following error:

18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error : 
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error : Unhandled Exception:
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error : System.IO.IOException: Could not create file "/mnt/c/Users/Marcos/Repositorios/WaveEngine/src/VisualTests/LowLevel/Runners/Wasm/bin/Debug/netstandard2.0/dist/managed/WebAssembly.Bindings.dll". File already exists.
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :   at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <a1ae6166591d4020b810288d19af38d4>:0 
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :   at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) [0x00000] in <a1ae6166591d4020b810288d19af38d4>:0 
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :   at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions)
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :   at System.IO.FileSystem.CopyFile (System.String sourceFullPath, System.String destFullPath, System.Boolean overwrite) [0x00035] in <a1ae6166591d4020b810288d19af38d4>:0 
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :   at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00062] in <a1ae6166591d4020b810288d19af38d4>:0 
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :   at System.IO.File.Copy (System.String sourceFileName, System.String destFileName) [0x00000] in <a1ae6166591d4020b810288d19af38d4>:0 
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :   at Driver.CopyFile (System.String sourceFileName, System.String destFileName, Driver+CopyType copyType, System.String typeFile) [0x000a1] in <e863e5fa48954a8389ce6485f2a15bb6>:0 
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :   at Driver.Run (System.String[] args) [0x00f33] in <e863e5fa48954a8389ce6485f2a15bb6>:0 
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :   at Driver.Main (System.String[] args) [0x00005] in <e863e5fa48954a8389ce6485f2a15bb6>:0 
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error : [ERROR] FATAL UNHANDLED EXCEPTION: System.IO.IOException: Could not create file "/mnt/c/Users/Marcos/Repositorios/WaveEngine/src/VisualTests/LowLevel/Runners/Wasm/bin/Debug/netstandard2.0/dist/managed/WebAssembly.Bindings.dll". File already exists.
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :   at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <a1ae6166591d4020b810288d19af38d4>:0 
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :   at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) [0x00000] in <a1ae6166591d4020b810288d19af38d4>:0 
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :   at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions)
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :   at System.IO.FileSystem.CopyFile (System.String sourceFullPath, System.String destFullPath, System.Boolean overwrite) [0x00035] in <a1ae6166591d4020b810288d19af38d4>:0 
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :   at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00062] in <a1ae6166591d4020b810288d19af38d4>:0 
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :   at System.IO.File.Copy (System.String sourceFileName, System.String destFileName) [0x00000] in <a1ae6166591d4020b810288d19af38d4>:0 
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :   at Driver.CopyFile (System.String sourceFileName, System.String destFileName, Driver+CopyType copyType, System.String typeFile) [0x000a1] in <e863e5fa48954a8389ce6485f2a15bb6>:0 
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :   at Driver.Run (System.String[] args) [0x00f33] in <e863e5fa48954a8389ce6485f2a15bb6>:0 
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :   at Driver.Main (System.String[] args) [0x00005] in <e863e5fa48954a8389ce6485f2a15bb6>:0 
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error : System.Exception: Failed to generate wasm layout (More details are available in diagnostics mode or using the MSBuild /bl switch)
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :    at Uno.Wasm.Bootstrap.ShellTask_v1e4fc8b053d7599d2bba00cf39b106f39c6d9ee7.RunPackager() in D:\a\1\s\src\Uno.Wasm.Bootstrap\ShellTask.cs:line 524
18>C:\Users\Marcos\.nuget\packages\uno.wasm.bootstrap\1.2.0-dev.24\build\Uno.Wasm.Bootstrap.targets(124,5): error :    at Uno.Wasm.Bootstrap.ShellTask_v1e4fc8b053d7599d2bba00cf39b106f39c6d9ee7.Execute() in D:\a\1\s\src\Uno.Wasm.Bootstrap\ShellTask.cs:line 165

Thanks in advance,

—Marcos

Can't build WASM app due to AssemblyResolutionException

When I attempt to build a WASM project on latest stable versions of Uno I get:

1>C:\...\Uno.Wasm.Bootstrap.targets(125,5): error : Unhandled Exception: Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Win32.Registry, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
1>C:\...\Uno.Wasm.Bootstrap.targets(125,5): error :    at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
1>C:\...\Uno.Wasm.Bootstrap.targets(125,5): error :    at Driver.Import(String ra, AssemblyKind kind)
1>C:\...\Uno.Wasm.Bootstrap.targets(125,5): error :    at Driver.Import(String ra, AssemblyKind kind)
1>C:\...\Uno.Wasm.Bootstrap.targets(125,5): error :    at Driver.Import(String ra, AssemblyKind kind)
1>C:\...\Uno.Wasm.Bootstrap.targets(125,5): error :    at Driver.Import(String ra, AssemblyKind kind)
1>C:\...\Uno.Wasm.Bootstrap.targets(125,5): error :    at Driver.Import(String ra, AssemblyKind kind)
1>C:\...\Uno.Wasm.Bootstrap.targets(125,5): error :    at Driver.Import(String ra, AssemblyKind kind)
1>C:\...\Uno.Wasm.Bootstrap.targets(125,5): error :    at Driver.Import(String ra, AssemblyKind kind)
1>C:\...\Uno.Wasm.Bootstrap.targets(125,5): error :    at Driver.Run(String[] args)
1>C:\...\Uno.Wasm.Bootstrap.targets(125,5): error :    at Driver.Main(String[] args)
1>C:\...\Uno.Wasm.Bootstrap.targets(125,5): error : System.Exception: Failed to generate wasm layout (More details are available in diagnostics mode or using the MSBuild /bl switch)
1>C:\...\Uno.Wasm.Bootstrap.targets(125,5): error :    at Uno.Wasm.Bootstrap.ShellTask_v1be21f07f93cd3a369c95001065dbda54db9dca8.RunPackager() in D:\a\1\s\src\Uno.Wasm.Bootstrap\ShellTask.cs:line 454
1>C:\...\Uno.Wasm.Bootstrap.targets(125,5): error :    at Uno.Wasm.Bootstrap.ShellTask_v1be21f07f93cd3a369c95001065dbda54db9dca8.Execute() in D:\a\1\s\src\Uno.Wasm.Bootstrap\ShellTask.cs:line 149

I tried purging bin, obj and restarting VS, PC, but nothing helped yet.

VS version - 16.4.2
Wasm.Bootstrap version: 1.0.10 (but not even downgrading helps)

Add support for Windows Build for AOT and Bitcode inputs

This issue tracks the requirements for the bootstrapper to work on Windows.

This issue is about deprecating the dynamic-release mode, which relies on emscripten's dynamic linking. Dynamic linking is causing all sorts of compatibility, stability and binary size issues.

Dynamic linking is used as debugging aid on Windows, and avoid having to run emscripten while allowing for wasm modules to be loaded dynamically. This decision was also based on the fact that emscripten tooling was historically slow, which is not the case anymore (starting from emscripten 1.39.1).

Building on Windows is currently not supported by mono, and even if it were supported, installing python, node and emscripten in the user's environment is not the best way to work at this point.

Impacts for this change:

  • Take a dependency on WSL when building for Windows when .bc files are referenced.
  • Building on a Windows CI machine will not be supported when .bc files are referenced. Linux build will be required.

Use package reference to another NetStandard project in AOT mode

nuget version 1.0.0-dev.269
When I add package reference from bootstraped project to another NetStandard project I get this error message

"/mnt/c/Users/patri/Documents/_tests/unobootstrap/WasmAOT/WasmAOT.csproj" (default target) (1:7) ->
"/mnt/c/Users/patri/Documents/_tests/unobootstrap/NetStandardLib/NetStandardLib.csproj" (default target) (2:6) ->
(GenerateBuildDependencyFile target) ->
  /usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018: The "GenerateDepsFile" task failed unexpectedly. [/mnt/c/Users/patri/Documents/_tests/unobootstrap/NetStandardLib/NetStandardLib.csproj]
/usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018: System.TypeLoadException: Could not load type of field 'Microsoft.NET.Build.Tasks.DependencyContextBuilder:_filteredPackages' (12) due
to: Could not resolve type with token 01000027 from typeref (expected class 'NuGet.Packaging.Core.PackageIdentity' in assembly 'NuGet.Packaging, Version=5.0.0.6, Culture=neutral, PublicKeyToken=31bf3856ad364e35') assembly:NuGet.Packaging, Version=5.0.0.6, Culture=neutral, PublicKeyToken=31bf3856ad364e35 type:NuGet.Packaging.Core.PackageIdentity member:(null) [/mnt/c/Users/patri/Documents/_tests/unobootstrap/NetStandardLib/NetStandardLib.csproj]
/usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:   at Microsoft.NET.Build.Tasks.TaskBase.Execute () [0x00000] in <c5e0e1dbe29a4fae9ad829d4b52ccc8b>:0  [/mnt/c/Users/patri/Documents/_tests/unobootstrap/NetStandardLib/NetStandardLib.csproj]
/usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <58f0218f988743a48dd7c84cbe933f4e>:0  [/mnt/c/Users/patri/Documents/_tests/unobootstrap/NetStandardLib/NetStandardLib.csproj]
/usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x001f6] in <58f0218f988743a48dd7c84cbe933f4e>:0  [/mnt/c/Users/patri/Documents/_tests/unobootstrap/NetStandardLib/NetStandardLib.csproj]

Iinker

<linker>
  <assembly fullname="WasmAOT" />
  <assembly fullname="NetStandardLib" />
</linker>`

csproj reference

    <ProjectReference Include="..\NetStandardLib\NetStandardLib.csproj">
      <Private>true</Private>
    </ProjectReference>

Mono.Linker.Steps.XmlResolutionException after adding assembly to LinkerConfig.xml

I am hitting a Mono.Linker.Steps.XmlResolutionException after I add the preview MvvmCross.Uno assembly to the LinkerConfig.xml file. Error output is as follows:

error : Fatal error in Mono IL Linker
error :
error : Unhandled Exception: Mono.Linker.Steps.XmlResolutionException: Failed to process XML description: resource App30.Wasm.xml in App30.Wasm, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null ---> System.ArgumentException: Name can not be empty
error : at Mono.Cecil.AssemblyNameReference.Parse(String fullName)
error : at Mono.Linker.Steps.ResolveFromXmlStep.ProcessAssemblies(LinkContext context, XPathNodeIterator iterator)
error : at Mono.Linker.Steps.ResolveFromXmlStep.Process()
error : --- End of inner exception stack trace ---
error : at Mono.Linker.Steps.ResolveFromXmlStep.Process()
error : at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
error : at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
error : at Mono.Linker.Pipeline.Process(LinkContext context)
error : at Mono.Linker.Driver.Run(ILogger customLogger)
error : at Mono.Linker.Driver.Execute(String[] args, ILogger customLogger)
error : at Mono.Linker.Driver.Main(String[] args)
error : System.Exception: Failed to execute the linker
error : at Uno.Wasm.Bootstrap.ShellTask_v41a20d03691000ce4bf68bdbe75bcd599e866b42.RunPackager() in D:\a\1\s\src\Uno.Wasm.Bootstrap\ShellTask.cs:line 626
error : at Uno.Wasm.Bootstrap.ShellTask_v41a20d03691000ce4bf68bdbe75bcd599e866b42.Execute() in D:\a\1\s\src\Uno.Wasm.Bootstrap\ShellTask.cs:line 160

Steps to reproduce

  1. Get MvvmCross.Uno preview Nuget package
  2. Create new Uno Platform App, update to the latest packages (1.1.0-dev433 of Uno.Wasm.Bootstrap, but fails with 1.0.10 stable as well)
  3. Add reference to the MvvmCross NuGet package in the WASM project
  4. Add MvvmCross to the LinkerConfig.xml file:
<linker>
  <assembly fullName="MvvmCross.Uno" />
  <assembly fullname="App30.Wasm" />
  <assembly fullname="Uno.UI" />

  <assembly fullname="System.Core">
	<!-- This is required by JSon.NET and any expression.Compile caller -->
	<type fullname="System.Linq.Expressions*" />
  </assembly>
</linker>
  1. Try to build the WASM head. Notice the build fails and error is output.

Build error on Linux with FullAOT enabled

I can't build with FullAOT enabled, but in Interpreter mode everything builds and runs fine. I'm on WSL Ubuntu 18.04.

When trying to build in AOT mode, I'm getting:

/home/user/.nuget/packages/uno.wasm.bootstrap/1.2.0-dev.16/build/Uno.Wasm.Bootstrap.targets(124,5): error : ninja: error: build.ninja:1: bad $-escape (literal $ must be written as $$) [/home/user/csharp/HelloWasm.csproj]
/home/user/.nuget/packages/uno.wasm.bootstrap/1.2.0-dev.16/build/Uno.Wasm.Bootstrap.targets(124,5): error : mono_sdkdir = \\wsl$\Ubuntu-18.04\tmp\mono-wasm-1add5cbc06a [/home/user/csharp/HelloWasm.csproj]
/home/user/.nuget/packages/uno.wasm.bootstrap/1.2.0-dev.16/build/Uno.Wasm.Bootstrap.targets(124,5): error :                    ^ near here [/home/user/csharp/HelloWasm.csproj]
/home/user/.nuget/packages/uno.wasm.bootstrap/1.2.0-dev.16/build/Uno.Wasm.Bootstrap.targets(124,5): error : System.Exception: Failed to generate AOT layout (More details are available in diagnostics mode or using the MSBuild /bl switch) [/home/user/csharp/HelloWasm.csproj]

I'm on Emscripten 1.39.9 and Mono 5.16.0. I also switched both to latest versions, results in same error.

This is my csproj file:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netstandard2.1</TargetFramework>
    <WasmShellMonoRuntimeExecutionMode>FullAOT</WasmShellMonoRuntimeExecutionMode>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Uno.Wasm.Bootstrap" Version="1.2.0-dev.1" />
    <PackageReference Include="Uno.Wasm.Bootstrap.DevServer" Version="1.2.0-dev.1" PrivateAssets="all" />
 </ItemGroup>

</Project>

HTTP protocol requirement for Enable the Debugger support

In the README, there is no information about the HTTP protocol requirement.
Chrome debugger works only with HTTP protocol or HTTPS with signed certificate.
Auto signed certificate fail without any clear message (can't connect to the endpoint).

The Packager command line in the ShellTask miss some assemblies

Steps to reproduce

  • Create a project X and add Uno.Wasm.Bootstrap
  • Add a ProjectReference to a project Y which use the type XmlDocument (from the dotnet standard assemblies).

Expected behavior

  • The directory dist\managed contains the assembly System.Xml.XmlDocument

Actual behavior

  • The directory dist\managed doesn't contain the assembly System.Xml.XmlDocument

Environment data

  • Windows 10 Insiders version 2004
  • Microsoft Visual Studio Community 2019 Preview Version 16.6.0 Preview 2.0
  • Uno.Wasm.Bootstrap last git

My Workaround

In the method RunPackager from ShellTask.cs, I add the referenced assemblies to solve the problem.

Before :

var packagerResults = RunProcess(packagerBinPath, $"--runtime-config={RuntimeConfiguration} {appDirParm} --zlib {debugOption} {referencePathsParameter} \"{AlignPath(TryConvertLongPath(Path.GetFullPath(Assembly)))}\"", _distPath);

After :

var _referencedAssembliesPaths = string.Join(" ", _referencedAssemblies.Select(r => $"\"{AlignPath(TryConvertLongPath(Path.GetFullPath(r)))}\" "));

var packagerResults = RunProcess(packagerBinPath, $"--runtime-config={RuntimeConfiguration} {appDirParm} --zlib {debugOption} {referencePathsParameter} {_referencedAssembliesPaths} \"{AlignPath(TryConvertLongPath(Path.GetFullPath(Assembly)))}\" ", _distPath);

How to create single wasm bundle

Hello!

Thank you for the great project!

Is it possible to build single-file distribution like here?

I've tried to compile the Hello World project with Uno.Wasm.Bootstrap package together with
<WasmShellMonoRuntimeExecutionMode>FullAOT</WasmShellMonoRuntimeExecutionMode>
but when serving this sample I see that multiple files are still downloaded

Screenshot from 2020-05-24 02-11-49_2

msbuild.log

Thanks in advance!

Debugging hotkey ignores keyboard configuration

Repro steps:

  1. Use a keyboard with physical QWERTY layout and software Dvorak layout (via usual Windows settings).
  2. Launch WASM app with debug enabled.
  3. Press debug hotkey combination (Alt+Shift+D)

Currently:

Doesn't launch. Have to use hardware-D instead.

Expected:

Debugging launches

image

Hosting in ASP.NET Core

I would like to host an Uno WASM project inside an ASP.NET Core project (similar to hosting Blazor WebAssembly). I dug a little into how Blazor does it, and it looks like they generate a StaticWebAssets.xml file based on referenced projects. This allows the ASP.NET Core app to serve static files from the WebAssembly project. Could you add similar targets to the Uno WASM build scripts to piggyback on this functionality?

Also, is there a sample showing how to do this? I'm making progress, but it's a slow going.

Failed to build.

I haven't find the doc about how to build Uno.Wasm.Bootstrap. But I found a build.ps1, so tried to run it. But the result is

PS D:\Workspace\1_Useful\Uno.Wasm.Bootstrap\build> D:\Workspace\1_Useful\Uno.Wasm.Bootstrap\build\build.ps1
Preparing to run build script...
Running build script...

========================================
Version
========================================
Cake.exe : An error occurred when executing task 'Version'.
At D:\Workspace\1_Useful\Uno.Wasm.Bootstrap\build\build.ps1:234 char:1
+ &$CAKE_EXE $cakeArguments
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (An error occurr...task 'Version'.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
Error: 
One or more errors occurred.
	
GitVersion: Process returned an error (exit code 1).

Error building with latest NuGet

Hey @jeromelaban,

The latest NuGet (139) must be somewhat broken because of this output:

/Users/marcos/.nuget/packages/uno.wasm.bootstrap/1.0.0-dev.139/build/Uno.Wasm.Bootstrap.targets(3,3): Error MSB4019: The imported project "/Users/marcos/.nuget/packages/uno.wasm.bootstrap/1.0.0-dev.139/build/Uno.Wasm.Bootstrap.Publish.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. (MSB4019) (WebAssemblyWebGLDemo)

Such file's actually named Uno.Wasm.Bootstrap.targets.

Thanks for your work on this :-)

—Marcos

StackOverflowException when MonoRuntimeDebuggerEnabled is false

When MonoRuntimeDebuggerEnabled is set to false, the dotnet server fails with a StackOverflowException, because the mono-wasm folder in the obj directory is not available.

Known workaround: <MonoRuntimeDebuggerEnabled>true</MonoRuntimeDebuggerEnabled>

From a gitter thread:

     [Native to Managed Transition]    
     [Managed to Native Transition]    
     System.Private.CoreLib.dll!System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(string name, System.Globalization.CultureInfo culture, System.Version version, bool throwOnFileNotFound, ref System.Threading.StackCrawlMark stackMark)    Unknown
     System.Private.CoreLib.dll!System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly(System.Globalization.CultureInfo lookForCulture, ref System.Threading.StackCrawlMark stackMark)    Unknown
     System.Private.CoreLib.dll!System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(System.Globalization.CultureInfo culture, System.Collections.Generic.Dictionary<string, System.Resources.ResourceSet> localResourceSets, bool tryParents, bool createIfNotExists, ref System.Threading.StackCrawlMark stackMark)    Unknown
     System.Private.CoreLib.dll!System.Resources.ResourceManager.InternalGetResourceSet(System.Globalization.CultureInfo requestedCulture, bool createIfNotExists, bool tryParents, ref System.Threading.StackCrawlMark stackMark)    Unknown
     System.Private.CoreLib.dll!System.Resources.ResourceManager.InternalGetResourceSet(System.Globalization.CultureInfo culture, bool createIfNotExists, bool tryParents)    Unknown
     System.Private.CoreLib.dll!System.Resources.ResourceManager.GetString(string name, System.Globalization.CultureInfo culture)    Unknown
     System.IO.FileSystem.dll!System.SR.GetResourceString(string resourceKey, string defaultString)    Unknown
     System.IO.FileSystem.dll!System.IO.Win32Marshal.GetExceptionForWin32Error(int errorCode, string path)    Unknown
     System.IO.FileSystem.dll!System.IO.Enumeration.FileSystemEnumerator<System.__Canon>.CreateDirectoryHandle(string path, bool ignoreNotFound)    Unknown
     System.IO.FileSystem.dll!System.IO.Enumeration.FileSystemEnumerator<string>.FileSystemEnumerator(string directory, System.IO.EnumerationOptions options)    Unknown
     System.IO.FileSystem.dll!System.IO.Enumeration.FileSystemEnumerable<string>.FileSystemEnumerable(string directory, System.IO.Enumeration.FileSystemEnumerable<string>.FindTransform transform, System.IO.EnumerationOptions options)    Unknown
     System.IO.FileSystem.dll!System.IO.Enumeration.FileSystemEnumerableFactory.UserDirectories(string directory, string expression, System.IO.EnumerationOptions options)    Unknown
     System.IO.FileSystem.dll!System.IO.Directory.InternalEnumeratePaths(string path, string searchPattern, System.IO.SearchTarget searchTarget, System.IO.EnumerationOptions options)    Unknown
     System.IO.FileSystem.dll!System.IO.Directory.GetDirectories(string path)    Unknown
     dotnet-unowasm.dll!Uno.Wasm.Bootstrap.Cli.Server.Startup.RegisterDebuggerLookup.__contextResolve|0(object s, System.Reflection.AssemblyName e)    Unknown
     System.Private.CoreLib.dll!System.Runtime.Loader.AssemblyLoadContext.GetFirstResolvedAssembly(System.Reflection.AssemblyName assemblyName)    Unknown
     System.Private.CoreLib.dll!System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(System.Reflection.AssemblyName assemblyName)    Unknown
     System.Private.CoreLib.dll!System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(System.IntPtr gchManagedAssemblyLoadContext, System.Reflection.AssemblyName assemblyName)    Unknown

Custom template Index.html issue.

This is csproj file, I used abs path:

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netstandard2.0</TargetFramework>
    <WasmHead>true</WasmHead>
    <DefineConstants>$(DefineConstants);__WASM__</DefineConstants>
    <NoWarn>NU1701</NoWarn>
  <WasmShellIndexHtmlPath>C:\Users\zgx\source\repos\App1\App1\App1.Wasm\Index.html</WasmShellIndexHtmlPath>
  <WasmPWAManifestFile>manifest.json</WasmPWAManifestFile>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)'=='Debug'">
    <MonoRuntimeDebuggerEnabled>true</MonoRuntimeDebuggerEnabled>
  </PropertyGroup>
  <ItemGroup>
    <Content Include="..\App1.UWP\Assets\*.png" Link="Assets\%(FileName)%(Extension)" />
    <Content Include="Fonts\winjs-symbols.woff2" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="WasmCSS\Fonts.css" />
    <EmbeddedResource Include="Styles\bootstrap.min.css" />
    <EmbeddedResource Include="Styles\font-awesome.min.css" />
    <EmbeddedResource Include="WasmScripts\AppManifest.js" />
  </ItemGroup>
  <ItemGroup>
    <LinkerDescriptor Include="LinkerConfig.xml" />
  </ItemGroup>
  <ItemGroup>
    <!-- 
    This item group is required by the project templace because of the
    new SDK-Style project, otherwise some files are not aded automatically.
    
    You can safely this ItemGroup completely.
    -->
    <Compile Remove="Program.cs" />
    <Compile Include="Program.cs" />
    <Content Include="LinkerConfig.xml" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Uno.UI" Version="1.40.0-dev.372" />
    <PackageReference Include="Uno.Wasm.Bootstrap" Version="1.0.0-dev.40" />
  </ItemGroup>
  <Import Project="..\App1.Shared\App1.Shared.projitems" Label="Shared" Condition="Exists('..\App1.Shared\App1.Shared.projitems')" />
  
  <ItemGroup>
    <None Remove="manifest.json" />
  </ItemGroup>

  <ItemGroup>
    <Content Include="manifest.json" />
  </ItemGroup>
</Project>

but dist index.html still use origin template.

Calling static methods

Hi, I am playing with Uno.Wasm.Bootstrap, it is really nice project 👍
I have problem with calling static method and FullAOT.
My c# code (namespace WasmSample)

class InitClass
 {
       static void Main(string[] args) => Console.WriteLine("Hello from C#!");
       static void Test(string[] args) => Console.WriteLine($"test static method");
}

When I am calling from js these static methods

BINDING.call_static_method("[WasmSample] WasmSample.InitClass:Main", []); //this one works
BINDING.call_static_method("[WasmSample] WasmSample.InitClass:Test", []); //error

I recieve this error:

   Uncaught Error: Could not find method: Test
   at Object.resolve_method_fqn (mono.js:8179)
   at Object.call_static_method (mono.js:8184)
   at <anonymous>:1:9

Please, could you explain me, why is it possible to call only Main method? Is it some restriction?

Using BaseIntermediateOutputPath to derive the emscripten-sdkdir parameter maybe doesn't always work

Running under Windows with WSL.

At least for the small test I did with a new project, BaseIntermediateOutputPath defaulted to "obj", which would be relative to the project directory. The problem is (I think), when ninja runs, its actually not running with its current directory set to the project directory, but instead to something like workAot.

The following change to my project file fixed it for me. Though I'm guessing there is a better absolute fix that can be made as well:

<Target Name="FixupEMSDKPath" BeforeTargets="BuildDist">
    <!-- The BuildDist target from the Uno.Wasm.Bootstrap package uses BaseIntermediateOutputPath to 
         help compute the location of the emsdk (to pass to the packager via the emscripten-sdkdir parameter. 
         However, that location needs to be absolute, because ninja runs from a different directory than
         the project path, specifically $(BaseIntermediateOutputPath)Debug\netstandard2.0\workAot (as an example). 
         So we'll make it absolute here to get around that issue -->
    <Message Importance="high" Text="proj path is: $(MSBuildProjectDirectory)"/>
    <Message Importance="high" Text="base intermediate is: $(BaseIntermediateOutputPath)"/>
    <PropertyGroup>
      <BaseIntermediateOutputPath>$(MSBuildProjectDirectory)\$(BaseIntermediateOutputPath)</BaseIntermediateOutputPath>
    </PropertyGroup>
    <Message Importance="high" Text="new base intermediate is: $(BaseIntermediateOutputPath)"/>
</Target>

without that project change, I would get an error like:

1>    Running [\\?\C:\Users\thatnerdyguy\source\repos\TestWASMSkiaDrawing\TestWASMSkiaDrawing\obj\Debug\netstandard2.0\workAot]: C:\WINDOWS\sysnative\bash.exe -c " cd `wslpath \"C:\Users\thatnerdyguy\source\repos\TestWASMSkiaDrawing\TestWASMSkiaDrawing\obj\Debug\netstandard2.0\workAot\"` &&   `wslpath \"ninja\"` "

...

1>    [5/64] obj/emsdk-1.39.11/emsdk/emsdk construct_env emsdk_env.sh
1>    FAILED: emsdk_env.sh
1>    obj/emsdk-1.39.11/emsdk/emsdk construct_env emsdk_env.sh
1>    /bin/sh: 1: obj/emsdk-1.39.11/emsdk/emsdk: not found

Accessing C/C++ Libraries

Sorry, but this is more of a question than an issue. I have a .NET Standard library that accesses a Windows DLL called Hid.dll. I would like to try to get this library working on Wasm with Platform Uno. I am naive about the limitations of Wasm. How would I start to figure out whether the library can be used at runtime? Does the browser somehow have to trust the library? Is there someone else I should be contacting about this?

Here is the error I'm getting:
image

Error building Uno WASM project on Linux

MyApp.zip
Follow instructions for a sample project at:
https://platform.uno/blog/announcing-uno-platform-support-for-visual-studio-code/

Updated project to latest versions:
Uno.UI Version="2.3.0-dev.11"
Uno.UI.RemoteControl Version="2.3.0-dev.11"
Uno.Wasm.Bootstrap Version="1.2.0-dev.26"
Uno.Wasm.Bootstrap.DevServer Version="1.2.0-dev.26"

Build output on Linux:

~/dev/MyApp $ dotnet build "/home/trevorde/dev/MyApp/MyApp.Wasm/MyApp.Wasm.csproj"
Microsoft (R) Build Engine version 16.5.0+d4cbfca49 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 470.93 ms for /home/trevorde/dev/MyApp/MyApp.Wasm/MyApp.Wasm.csproj.
  MyApp.Wasm -> /home/trevorde/dev/MyApp/MyApp.Wasm/bin/Debug/netstandard2.0/MyApp.Wasm.dll
/home/trevorde/.nuget/packages/uno.wasm.bootstrap/1.2.0-dev.26/build/Uno.Wasm.Bootstrap.targets(124,5): error : System.ComponentModel.Win32Exception (1
3): Permission denied [/home/trevorde/dev/MyApp/MyApp.Wasm/MyApp.Wasm.csproj]
/home/trevorde/.nuget/packages/uno.wasm.bootstrap/1.2.0-dev.26/build/Uno.Wasm.Bootstrap.targets(124,5): error :    at System.Diagnostics.Process.ForkAn
dExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean 
setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOn
NoExec) [/home/trevorde/dev/MyApp/MyApp.Wasm/MyApp.Wasm.csproj]
/home/trevorde/.nuget/packages/uno.wasm.bootstrap/1.2.0-dev.26/build/Uno.Wasm.Bootstrap.targets(124,5): error :    at System.Diagnostics.Process.StartC
ore(ProcessStartInfo startInfo) [/home/trevorde/dev/MyApp/MyApp.Wasm/MyApp.Wasm.csproj]
/home/trevorde/.nuget/packages/uno.wasm.bootstrap/1.2.0-dev.26/build/Uno.Wasm.Bootstrap.targets(124,5): error :    at System.Diagnostics.Process.Start(
) [/home/trevorde/dev/MyApp/MyApp.Wasm/MyApp.Wasm.csproj]
/home/trevorde/.nuget/packages/uno.wasm.bootstrap/1.2.0-dev.26/build/Uno.Wasm.Bootstrap.targets(124,5): error :    at Uno.Wasm.Bootstrap.ShellTask_v4fd
6cf698646d7468ae0ef1f40cf3898bc0d4d77.RunProcess(String executable, String parameters, String workingDirectory) in D:\a\1\s\src\Uno.Wasm.Bootstrap\Shel
lTask.cs:line 426 [/home/trevorde/dev/MyApp/MyApp.Wasm/MyApp.Wasm.csproj]
/home/trevorde/.nuget/packages/uno.wasm.bootstrap/1.2.0-dev.26/build/Uno.Wasm.Bootstrap.targets(124,5): error :    at Uno.Wasm.Bootstrap.ShellTask_v4fd6cf698646d7468ae0ef1f40cf3898bc0d4d77.RunPackager() in D:\a\1\s\src\Uno.Wasm.Bootstrap\ShellTask.cs:line 641 [/home/trevorde/dev/MyApp/MyApp.Wasm/MyApp.Wasm.csproj]
/home/trevorde/.nuget/packages/uno.wasm.bootstrap/1.2.0-dev.26/build/Uno.Wasm.Bootstrap.targets(124,5): error :    at Uno.Wasm.Bootstrap.ShellTask_v4fd6cf698646d7468ae0ef1f40cf3898bc0d4d77.Execute() in D:\a\1\s\src\Uno.Wasm.Bootstrap\ShellTask.cs:line 166 [/home/trevorde/dev/MyApp/MyApp.Wasm/MyApp.Wasm.csproj]

Build FAILED.

/home/trevorde/.nuget/packages/uno.wasm.bootstrap/1.2.0-dev.26/build/Uno.Wasm.Bootstrap.targets(124,5): error : System.ComponentModel.Win32Exception (13): Permission denied [/home/trevorde/dev/MyApp/MyApp.Wasm/MyApp.Wasm.csproj]
/home/trevorde/.nuget/packages/uno.wasm.bootstrap/1.2.0-dev.26/build/Uno.Wasm.Bootstrap.targets(124,5): error :    at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec) [/home/trevorde/dev/MyApp/MyApp.Wasm/MyApp.Wasm.csproj]
/home/trevorde/.nuget/packages/uno.wasm.bootstrap/1.2.0-dev.26/build/Uno.Wasm.Bootstrap.targets(124,5): error :    at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) [/home/trevorde/dev/MyApp/MyApp.Wasm/MyApp.Wasm.csproj]
/home/trevorde/.nuget/packages/uno.wasm.bootstrap/1.2.0-dev.26/build/Uno.Wasm.Bootstrap.targets(124,5): error :    at System.Diagnostics.Process.Start() [/home/trevorde/dev/MyApp/MyApp.Wasm/MyApp.Wasm.csproj]
/home/trevorde/.nuget/packages/uno.wasm.bootstrap/1.2.0-dev.26/build/Uno.Wasm.Bootstrap.targets(124,5): error :    at Uno.Wasm.Bootstrap.ShellTask_v4fd6cf698646d7468ae0ef1f40cf3898bc0d4d77.RunProcess(String executable, String parameters, String workingDirectory) in D:\a\1\s\src\Uno.Wasm.Bootstrap\ShellTask.cs:line 426 [/home/trevorde/dev/MyApp/MyApp.Wasm/MyApp.Wasm.csproj]
/home/trevorde/.nuget/packages/uno.wasm.bootstrap/1.2.0-dev.26/build/Uno.Wasm.Bootstrap.targets(124,5): error :    at Uno.Wasm.Bootstrap.ShellTask_v4fd6cf698646d7468ae0ef1f40cf3898bc0d4d77.RunPackager() in D:\a\1\s\src\Uno.Wasm.Bootstrap\ShellTask.cs:line 641 [/home/trevorde/dev/MyApp/MyApp.Wasm/MyApp.Wasm.csproj]
/home/trevorde/.nuget/packages/uno.wasm.bootstrap/1.2.0-dev.26/build/Uno.Wasm.Bootstrap.targets(124,5): error :    at Uno.Wasm.Bootstrap.ShellTask_v4fd6cf698646d7468ae0ef1f40cf3898bc0d4d77.Execute() in D:\a\1\s\src\Uno.Wasm.Bootstrap\ShellTask.cs:line 166 [/home/trevorde/dev/MyApp/MyApp.Wasm/MyApp.Wasm.csproj]
    0 Warning(s)
    1 Error(s)

Page does not load for debug

No page is loaded for debug when using version 1.1.0-dev.445. To test, simply create a default project and update Uno.Wasm.Bootstrap before attempting debug - page does not load. If you revert to previous version of Uno.Wasm.Debug page loads successfully.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.