Skip to content

Conversation

@radical
Copy link
Member

@radical radical commented Sep 24, 2022

For supporting templates installed from two different wasm workloads, like wasm-experimental, and wasm-experimental-7, they need to be differentiated.

  • Update identity to be unique with .8.0 suffix
  • Add a framework parameter with default value of net8.0
    • this has been added for net7 templates also, and dotnet new will show both as options.
$ dotnet new wasmbrowser -h
...
  -f, --framework <net7.0|net8.0>  The target framework for the project.
                                   Type: choice
                                     net8.0  Target net8.0
                                     net7.0  Target net7.0
                                   Default: net8.0

@radical radical added arch-wasm WebAssembly architecture area-Build-mono labels Sep 24, 2022
@ghost ghost assigned radical Sep 24, 2022
@ghost
Copy link

ghost commented Sep 24, 2022

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

For supporting templates installed from two different wasm workloads, like wasm-experimental, and wasm-experimental-7, they need to be differentiated.

  • Update identity to be unique with .8.0 suffix
  • Add a framework parameter with default value of net8.0
    • this will be added for net7 templates also, and dotnet new will show both as options.
$ dotnet new wasmbrowser -h
...
  -f, --framework <net7.0|net8.0>  The target framework for the project.
                                   Type: choice
                                     net8.0  Target net8.0
                                     net7.0  Target net7.0
                                   Default: net8.0

But until the packages from #76123 become available, and we switch to those:

$ dotnet new wasmbrowser -h
Template options:
  -f, --framework <net8.0>  The target framework for the project.
                            Type: choice
                              net8.0  Target net8.0
                            Default: net8.0
Author: radical
Assignees: -
Labels:

arch-wasm, area-Build-mono

Milestone: -

@radical radical requested a review from radekdoulik September 24, 2022 14:42
@radical radical marked this pull request as draft September 24, 2022 15:10
@radical
Copy link
Member Author

radical commented Sep 24, 2022

This needs packages from #76123 . Without that:

      [] --------------------------------------------------------------------------------------
      [] Unable to resolve the template, the following installed templates are conflicting:
      [] Identity             Template Name            Short Name   Language  Author     Package
      [] -------------------  -----------------------  -----------  --------  ---------  -------
      [] WebAssembly.Console  WebAssembly Console App  wasmconsole  C#        Microsoft         
      [] WebAssembly.Console  WebAssembly Console App  wasmconsole  C#        Microsoft         
      [] 
      [] Uninstall the template packages containing the templates to keep only one template from the list or add the template options which differentiate the template to run.

This could fail like:
```
WasmAppHost --runtime-config /tmp/cc/bin/Debug/net7.0/browser-wasm/AppBundle/cc.runtimeconfig.json --forward-console
Unhandled exception. System.InvalidOperationException: Failed to determine web server's IP address or port
   at Microsoft.WebAssembly.AppHost.WebServer.StartAsync(WebServerOptions options, ILogger logger, CancellationToken token)
   at Microsoft.WebAssembly.AppHost.BrowserHost.StartWebServerAsync(String appPath, Boolean forwardConsole, String[] urls, CancellationToken token)
   at Microsoft.WebAssembly.AppHost.BrowserHost.RunAsync(ILoggerFactory loggerFactory, CancellationToken token)
   at Microsoft.WebAssembly.AppHost.BrowserHost.InvokeAsync(CommonConfiguration commonArgs, ILoggerFactory loggerFactory, ILogger logger, CancellationToken token)
   at Microsoft.WebAssembly.AppHost.WasmAppHost.Main(String[] args)
   at Microsoft.WebAssembly.AppHost.WasmAppHost.<Main>(String[] args)
```

Instead read the addresses on application lifetime's ApplicationStarted
event.
```
WasmAppHost --runtime-config /datadisks/disk1/work/99FC08A1/w/B6B509D6/e/browser_Debug_crvdkcbp.f3f/bin/Debug/net7.0/browser-wasm/AppBundle/browser_Debug_crvdkcbp.f3f.runtimeconfig.json --forward-console
Unhandled exception. System.InvalidOperationException: Dynamic port binding is not supported when binding to localhost. You must either bind to 127.0.0.1:0 or [::1]:0, or both.
   at Microsoft.AspNetCore.Server.Kestrel.Core.LocalhostListenOptions..ctor(Int32 port)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.ParseAddress(String address, Boolean& https)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.BindAsync(AddressBindContext context, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IEnumerable`1 listenOptions, AddressBindContext context, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Hosting.WebHost.StartAsync(CancellationToken cancellationToken)
   at Microsoft.WebAssembly.AppHost.WebServer.StartAsync(WebServerOptions options, ILogger logger, CancellationToken token)
   at Microsoft.WebAssembly.AppHost.BrowserHost.StartWebServerAsync(String appPath, Boolean forwardConsole, String[] urls, CancellationToken token)
   at Microsoft.WebAssembly.AppHost.BrowserHost.RunAsync(ILoggerFactory loggerFactory, CancellationToken token)
   at Microsoft.WebAssembly.AppHost.BrowserHost.InvokeAsync(CommonConfiguration commonArgs, ILoggerFactory loggerFactory, ILogger logger, CancellationToken token)
   at Microsoft.WebAssembly.AppHost.WasmAppHost.Main(String[] args)
   at Microsoft.WebAssembly.AppHost.WasmAppHost.<Main>(String[] args)
```
@radical radical merged commit 78a625d into dotnet:main Sep 29, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Oct 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture area-Build-mono

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants