Skip to content

Can't build large webassembly project in .net8 in Release/AOT #92100

Closed
@jtorjo

Description

@jtorjo

Description

I have a pretty large project (roughly 100K LOC).
It successfully builds in both .net6 and .net7.
Since the third preview of .net8, I've been trying to compile it with .net8 (so basically, each month, I'd get the latest preview, and retry).

I always get this error:

 C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\8.0.0-rc.1.23419.4\Sdk\WasmApp.Native.targ
       ets(681,5): error : Precompiling failed for D:\john\_...\obj\Any CPU\Release\net
	   8.0\wasm\for-publish\aot-in\aot-instances.dll with exit code 1. [D:\john\....net8.csproj]

Is there a way to at least understand the underlying error, and see if you can fix it?

The project is a webassembly project.
Note: the solution compiles and runs in .net8 in debug mode no AOT, and in Release mode no AOT.

Reproduction Steps

The csproj file:

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <NoXamlPreprocessor>True</NoXamlPreprocessor>
    <OpenSilverType>4</OpenSilverType>
    <PublishTrimmed>true</PublishTrimmed>
    <!-- 
    <RunAOTCompilation>true</RunAOTCompilation>
    <AotAssemblies>True</AotAssemblies>	
	-->
	<EmccInitialHeapSize>2147483648</EmccInitialHeapSize>
	<MtouchUseLlvm>False</MtouchUseLlvm>

  </PropertyGroup>
...

If I uncomment those 2 lines, I get the error:

The command line:

msbuild <proj>.net8.csproj -m -p:Configuration=Release /p:Platform="Any CPU" /p:DeployOnBuild=true;PublishProfile=.\Properties\PublishProfiles\FolderProfileAOT8.pubxml

The profile file:

<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
  <PropertyGroup>
    <DeleteExistingFiles>true</DeleteExistingFiles>
    <ExcludeApp_Data>false</ExcludeApp_Data>
    <LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <PublishProvider>FileSystem</PublishProvider>
    <PublishUrl>bin\Release\net8.0\browser-wasm\publish-AOT\</PublishUrl>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <_TargetId>Folder</_TargetId>
    <SiteUrlToLaunchAfterPublish />
    <TargetFramework>net8.0</TargetFramework>
    <RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
    <ProjectGuid>d517a199-85d4-42f4-8248-edf1f37245cf</ProjectGuid>
    <SelfContained>true</SelfContained>
  </PropertyGroup>
</Project>

Expected behavior

The project should build.

Actual behavior

I get the error above.

Regression?

No response

Known Workarounds

There are no workarounds I found

Configuration

Configuration:

  • .net8.rc.1 (build: 14th of Sept 2023)
  • Windows 11/x64

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions