Skip to content

Blazor wasm AOT: don't send all arguments via the command line, because of 8191 command line char limit #123257

@jtorjo

Description

@jtorjo

Description

When targetting Blazor WASM, and we publish to a folder, regardless of targetting .net8/.net9/.net10.
As part of the build process, at some point, some llvm* tools are called.

In the command line, all the intermediary .o files are passed via the command line. When there's a decent amount of files, we can easily go over the 8191 command line limit.

The command will fail and exit with code 1. Publishing fails.

I believe this is not a big issue on Windows 10/11, becasue the limit seems to be around 32k chars, but it's still an issue for Windows Server 2016 and lower.

This workaround sometimes works but depends on the project:

obj
c:\uaos

This impacts the OpenSilver build process.

Example of a command that fails in this way:

.\llvm-size.exe -d --format=sysv "c:\uaos\net8.0\wasm\for-publish\Microsoft.AspNetCore.Components.dll.o" "c:\uaos\net8.0\wasm\for-publish\Microsoft.AspNetCore.Components.Web.dll.o" "c:\uaos\net8.0\wasm\for-publish\Microsoft.AspNetCore.Components.WebAssembly.dll.o" "c:\uaos\net8.0\wasm\for-publish\Microsoft.Data.Edm.dll.o" "c:\uaos\net8.0\wasm\for-publish\Microsoft.Data.OData.dll.o" "c:\uaos\net8.0\wasm\for-publish\Microsoft.Extensions.Configuration.dll.o" "c:\uaos\net8.0\wasm\for-publish\Microsoft.Extensions.Configuration.Abstractions.dll.o" "c:\uaos\net8.0\wasm\for-publish\Microsoft.Extensions.Configuration.Json.dll.o" "c:\uaos\net8.0\wasm\for-publish\Microsoft.Extensions.DependencyInjection.dll.o" "c:\uaos\net8.0\wasm\for-publish\Microsoft.Extensions.DependencyInjection.Abstractions.dll.o" "c:\uaos\net8.0\wasm\for-publish\Microsoft.Extensions.Logging.dll.o" "c:\uaos\net8.0\wasm\for-publish\Microsoft.Extensions.Logging.Abstractions.dll.o" "c:\uaos\net8.0\wasm\for-publish\Microsoft.Extensions.ObjectPool.dll.o" "c:\uaos\net8.0\wasm\for-publish\Microsoft.Extensions.Options.dll.o" "c:\uaos\net8.0\wasm\for-publish\Microsoft.Extensions.Primitives.dll.o" "c:\uaos\net8.0\wasm\for-publish\Microsoft.JSInterop.dll.o" "c:\uaos\net8.0\wasm\for-publish\Newtonsoft.Json.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenSilver.Browser.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenSilver.Controls.Data.DataForm.Toolkit.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenSilver.Controls.Data.Input.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenSilver.Controls.Data.Toolkit.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenSilver.Controls.Data.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenSilver.Controls.DataVisualization.Toolkit.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenSilver.Controls.Input.Toolkit.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenSilver.Controls.Input.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenSilver.Controls.Layout.Toolkit.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenSilver.Controls.Navigation.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenSilver.Controls.Theming.Toolkit.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenSilver.Controls.Toolkit.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenSilver.Controls.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenSilver.Data.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenSilver.Expression.Effects.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenSilver.Expression.Interactions.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenSilver.Interactivity.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenSilver.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.ComponentModel.Composition.Initialization.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenRiaServices.DomainServices.Client.Web.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenRiaServices.DomainServices.Client.dll.o" "c:\uaos\net8.0\wasm\for-publish\OpenSilver.WebAssembly.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.ComponentModel.Composition.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Security.Cryptography.Pkcs.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Security.Cryptography.Xml.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.ServiceModel.Http.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.ServiceModel.Duplex.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.ServiceModel.Primitives.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.ServiceModel.Security.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.ServiceModel.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Spatial.dll.o" "c:\uaos\net8.0\wasm\for-publish\Microsoft.Data.Services.Client.OpenSilver.dll.o" "c:\uaos\net8.0\wasm\for-publish\Ua.OpenSilver.dll.o" "c:\uaos\net8.0\wasm\for-publish\Ua.OpenSilver.Browser.dll.o" "c:\uaos\net8.0\wasm\for-publish\Microsoft.CSharp.dll.o" "c:\uaos\net8.0\wasm\for-publish\Microsoft.Win32.Primitives.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Buffers.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Collections.Concurrent.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Collections.Immutable.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Collections.NonGeneric.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Collections.Specialized.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Collections.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.ComponentModel.Annotations.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.ComponentModel.EventBasedAsync.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.ComponentModel.Primitives.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.ComponentModel.TypeConverter.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.ComponentModel.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Console.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Data.Common.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Diagnostics.Debug.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Diagnostics.DiagnosticSource.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Diagnostics.StackTrace.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Diagnostics.TraceSource.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Diagnostics.Tracing.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Drawing.Primitives.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Drawing.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Formats.Asn1.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Globalization.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.IO.Compression.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.IO.IsolatedStorage.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.IO.MemoryMappedFiles.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.IO.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Linq.Expressions.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Linq.Queryable.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Linq.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Memory.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Net.Http.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Net.Primitives.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Net.Requests.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Net.Security.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Net.WebClient.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Net.WebHeaderCollection.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Net.WebProxy.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Net.WebSockets.Client.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Net.WebSockets.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Numerics.Vectors.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.ObjectModel.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Private.DataContractSerialization.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Private.Uri.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Private.Xml.Linq.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Private.Xml.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Reflection.DispatchProxy.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Reflection.Emit.ILGeneration.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Reflection.Emit.Lightweight.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Reflection.Emit.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Reflection.Extensions.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Reflection.Metadata.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Reflection.Primitives.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Reflection.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Resources.ResourceManager.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Runtime.CompilerServices.Unsafe.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Runtime.Extensions.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Runtime.InteropServices.JavaScript.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Runtime.InteropServices.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Runtime.Numerics.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Runtime.Serialization.Formatters.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Runtime.Serialization.Primitives.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Runtime.Serialization.Xml.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Runtime.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Security.AccessControl.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Security.Claims.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Security.Cryptography.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Security.Principal.Windows.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Text.Encoding.Extensions.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Text.Encoding.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Text.Encodings.Web.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Text.Json.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Text.RegularExpressions.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Threading.Overlapped.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Threading.Tasks.Extensions.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Threading.Tasks.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Threading.Thread.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Threading.ThreadPool.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Threading.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Web.HttpUtility.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Xml.Linq.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Xml.ReaderWriter.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Xml.XDocument.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Xml.XmlSerializer.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.dll.o" "c:\uaos\net8.0\wasm\for-publish\netstandard.dll.o" "c:\uaos\net8.0\wasm\for-publish\System.Private.CoreLib.dll.o" "c:\uaos\net8.0\wasm\for-publish\aot-instances.dll.o"

Please note that I executed this in command line -> failure.
I executed the same in powershell (which doesn't have this limitation) and the command runs successfully

Reproduction Steps

  1. Create a simple OpenSilver application (that automatically targets Blazor WebAssembly)
  2. Select the .Browser project, and click Publish
  3. Publish it to a folder, and select AOT
  4. run the publish process

If you do this on Windows Server 2016, it will fail

Expected behavior

This should build successfully on AOT.

Actual behavior

Publishing fails.

Regression?

No response

Known Workarounds

No response

Configuration

Running on Windows Server 2016

Other information

No response

Metadata

Metadata

Labels

arch-wasmWebAssembly architecturearea-Codegen-AOT-mononeeds-further-triageIssue has been initially triaged, but needs deeper consideration or reconsideration

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions