-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[wasm] Templates don't pass the command line arguments to the app #76201
Comments
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsIf we print the command line args: using System;
using System.Runtime.InteropServices.JavaScript;
Console.WriteLine("Hello, Console!");
Console.WriteLine ($"command line args: {string.Join(',', args)}");
return 0;
public partial class MyClass
{
[JSExport]
internal static string Greeting()
{
var text = $"Hello, World! Greetings from node version: {GetNodeVersion()}";
return text;
}
[JSImport("node.process.version", "main.mjs")]
internal static partial string GetNodeVersion();
} .. and run:
The command line arguments await runMainAndExit(config.mainAssemblyName, ["dotnet", "is", "great!"]); This doesn't get caught by Wasm.Build.Tests because the tests are explicitly patching the generated code runtime/src/tests/BuildWasmApps/Wasm.Build.Tests/WasmTemplateTests.cs Lines 48 to 58 in 4bd3ee5
And the same is done for the browser too. We should instead:
cc @pavelsavara
|
we could have simpler |
Why do we have Using |
Because it's a lower level API which is not part of the builder pattern.
That's OK :) |
Partially. It passes command line args for the console template. |
I updated it for Net8 then |
* Update dependencies from https://github.com/dotnet/arcade build 20220920.1 Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions From Version 8.0.0-beta.22469.1 -> To Version 8.0.0-beta.22470.1 * Update dependencies from https://github.com/dotnet/arcade build 20220920.3 Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions From Version 8.0.0-beta.22469.1 -> To Version 8.0.0-beta.22470.3 * Update dependencies from https://github.com/dotnet/arcade build 20220921.2 Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions From Version 8.0.0-beta.22469.1 -> To Version 8.0.0-beta.22471.2 * Update dependencies from https://github.com/dotnet/arcade build 20220922.1 Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions From Version 8.0.0-beta.22469.1 -> To Version 8.0.0-beta.22472.1 * Update dependencies from https://github.com/dotnet/arcade build 20220923.1 Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions From Version 8.0.0-beta.22469.1 -> To Version 8.0.0-beta.22473.1 * Update dependencies from https://github.com/dotnet/arcade build 20220926.4 Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions From Version 8.0.0-beta.22469.1 -> To Version 8.0.0-beta.22476.4 * Update dependencies from https://github.com/dotnet/arcade build 20220927.1 Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions From Version 8.0.0-beta.22469.1 -> To Version 8.0.0-beta.22477.1 * InstallWorkloadFromArtifacts: Remove hack because we have an updated sdk now * [wasm] WBT: Make project names unique * [wasm] WBT: Use a clean NUGET_PACKAGES dir separate from the project directory * [wasm] WBT: Fixes to work with latest sdk - Use only one source of which tfm to use - Allow a different tfm for blazor - Add `dotnet8` nuget feed for tests - Support more than one choice for nuget.config, like for net7, or net8 * Revert to test projects created in bindir, instead of a temp one This was necessary because on windows the tmp path is very long, causing the test project paths to become too long causing build failures. * [wasm] fix weird build failures `MSBuildSDKsPath` is set by runtime repo, and that interferes with the test projects. To avoid this the `MSBuildSDKsPath` was set to `""` in the test environment. But even that can negatively affect the build because msbuild treats environment variables as "global properties" that cannot be changed. This manifests when running: `$ dotnet run --no-build` .. it would fail with `/foo/bar.csproj is not a valid project file`. Instead, explicitly *remove* `MSBuildSDKsPath` from the environment when invoking the process. * PInvokeTableGenerator: Find path to WasmAppBuilder.dll at test time .. instead of depending on *one* runtime pack version. This is needed when we have more than one workload installed. * WasmAppHost: allow rollForward to work with newer sdks * Don't use the nuget packages directory as fallback. .. because we explicitly set `NUGET_PACKAGES` envvar now. * [wasm] Use the latest sdk for Wasm.Build.Tests * Add missing nuget8.config * WBT: workaround for #76201 * Update dependencies from https://github.com/dotnet/arcade build 20220928.2 Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions From Version 8.0.0-beta.22469.1 -> To Version 8.0.0-beta.22478.2 * Revert "WBT: workaround for #76201" This reverts commit 33e3679. * Revert "Add missing nuget8.config" This reverts commit dec9861. * Revert "[wasm] Use the latest sdk for Wasm.Build.Tests" This reverts commit 3a15bdf. * Revert "Don't use the nuget packages directory as fallback." This reverts commit 785504e. * Revert "WasmAppHost: allow rollForward to work with newer sdks" This reverts commit 28cfbcd. * Revert "PInvokeTableGenerator: Find path to WasmAppBuilder.dll at test time" This reverts commit 33dbf98. * Revert "[wasm] fix weird build failures" This reverts commit 1a731fb. * Revert "Revert to test projects created in bindir, instead of a temp one" This reverts commit 57ff0dd. * Revert "[wasm] WBT: Fixes to work with latest sdk" This reverts commit 0aa1b5a. * Revert "[wasm] WBT: Use a clean NUGET_PACKAGES dir separate from the project directory" This reverts commit 0678940. * Revert "[wasm] WBT: Make project names unique" This reverts commit 55120ac. * Revert "InstallWorkloadFromArtifacts: Remove hack because we have an updated sdk now" This reverts commit 60e9f8c. * Fix Wasm.Build.Tests failures - Use latest sdk for testing - Add dotnet8 feed, needed by blazorwasm templates - Workaround a bug in 7.0 templates which will be fixed by #76373 . And this can be removed once we have packages with that. * WasmAppHost: Set rollForward=latestMajor to work with newer sdks * Update dependencies from https://github.com/dotnet/arcade build 20220929.2 Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions From Version 8.0.0-beta.22469.1 -> To Version 8.0.0-beta.22479.2 * Update dependencies from https://github.com/dotnet/arcade build 20220930.2 Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions From Version 8.0.0-beta.22469.1 -> To Version 8.0.0-beta.22480.2 * Revert changes to source-build.yml It was missing dotnet/arcade#10782 * Update dependencies from https://github.com/dotnet/arcade build 20220930.2 Microsoft.DotNet.ApiCompat , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions From Version 8.0.0-beta.22469.1 -> To Version 8.0.0-beta.22480.2 * Revert changes again Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Ankit Jain <[email protected]> Co-authored-by: Alexander Köplinger <[email protected]>
* InstallWorkloadFromArtifacts: Remove hack because we have an updated sdk now * [wasm] WBT: Make project names unique * [wasm] WBT: Use a clean NUGET_PACKAGES dir separate from the project directory * [wasm] WBT: Fixes to work with latest sdk - Use only one source of which tfm to use - Allow a different tfm for blazor - Add `dotnet8` nuget feed for tests - Support more than one choice for nuget.config, like for net7, or net8 * WBT: Revert to test projects created in bindir, instead of a temp one This was necessary because on windows the tmp path is very long, causing the test project paths to become too long causing build failures. * [wasm] fix weird build failures `MSBuildSDKsPath` is set by runtime repo, and that interferes with the test projects. To avoid this the `MSBuildSDKsPath` was set to `""` in the test environment. But even that can negatively affect the build because msbuild treats environment variables as "global properties" that cannot be changed. This manifests when running: `$ dotnet run --no-build` .. it would fail with `/foo/bar.csproj is not a valid project file`. Instead, explicitly *remove* `MSBuildSDKsPath` from the environment when invoking the process. * WBT: PInvokeTableGenerator: Find path to WasmAppBuilder.dll at test time .. instead of depending on *one* runtime pack version. This is needed when we have more than one workload installed. * WBT: Don't use the nuget packages directory as fallback. .. because we explicitly set `NUGET_PACKAGES` envvar now. * [wasm] Use the latest sdk for Wasm.Build.Tests * WBT: Add missing nuget8.config * WBT: workaround for #76201 * WasmAppHost: add rollforward=latestMajor
@radical is this resolved? |
I would like to see it resolved together with #88760 |
cc @richlander |
Tagging subscribers to this area: @vitek-karas, @agocke Issue DetailsIf we print the command line args: using System;
using System.Runtime.InteropServices.JavaScript;
Console.WriteLine("Hello, Console!");
Console.WriteLine ($"command line args: {string.Join(',', args)}");
return 0;
public partial class MyClass
{
[JSExport]
internal static string Greeting()
{
var text = $"Hello, World! Greetings from node version: {GetNodeVersion()}";
return text;
}
[JSImport("node.process.version", "main.mjs")]
internal static partial string GetNodeVersion();
} .. and run:
The command line arguments await runMainAndExit(config.mainAssemblyName, ["dotnet", "is", "great!"]); This doesn't get caught by Wasm.Build.Tests because the tests are explicitly patching the generated code runtime/src/tests/BuildWasmApps/Wasm.Build.Tests/WasmTemplateTests.cs Lines 48 to 58 in 4bd3ee5
And the same is done for the browser too. We should instead:
cc @pavelsavara
|
What area owns template argument parsing and where should this be redirected? |
I think this is all WasmAppHost related |
I think the app host doesn't get all the information it needs, but I hope I'm wrong |
If we print the command line args:
.. and run:
The command line arguments
x y z
were ignored, and instead we gotdotnet,is,great
. And that's because themain.mjs
has:This doesn't get caught by Wasm.Build.Tests because the tests are explicitly patching the generated code
runtime/src/tests/BuildWasmApps/Wasm.Build.Tests/WasmTemplateTests.cs
Lines 48 to 58 in 4bd3ee5
And the same is done for the browser too.
We should instead:
cc @pavelsavara
The text was updated successfully, but these errors were encountered: