Skip to content
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

ILC: FileNotFoundException for base type from unresolved assembly #103843

Closed
sbomer opened this issue Jun 21, 2024 · 1 comment · Fixed by #103962
Closed

ILC: FileNotFoundException for base type from unresolved assembly #103843

sbomer opened this issue Jun 21, 2024 · 1 comment · Fixed by #103962

Comments

@sbomer
Copy link
Member

sbomer commented Jun 21, 2024

Discovered while investigating a similar linker failure in #93797. Repro:

app.csproj:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net8.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
        <PublishAot>true</PublishAot>
        <WarningsAsErrors>false</WarningsAsErrors>
        <NoWarn>NU1605;NU1603;NU1701</NoWarn>
    </PropertyGroup>

    <ItemGroup>
        <TrimmerRootAssembly Include="Syncfusion.Maui.Gauges" />
        <PackageReference Include="Syncfusion.Maui.Gauges" Version="20.4.40" />
    </ItemGroup>
</Project>

dotnet publish

Stack trace from the output:

EXEC : error : Failed to load assembly 'Microsoft.Maui.Controls' [/home/svbomer/src/test-apps/crashes/crashes.csproj]
         Internal.TypeSystem.TypeSystemException+FileNotFoundException: Failed to load assembly 'Microsoft.Maui.Controls'
            at Internal.TypeSystem.ThrowHelper.ThrowFileNotFoundException(ExceptionStringID, String) + 0x30
            at Internal.TypeSystem.ResolutionFailure.Throw() + 0xfd
            at Internal.TypeSystem.Ecma.EcmaType.InitializeBaseType() + 0x1da
            at ILCompiler.DependencyAnalysis.TypeMetadataNode.GetStaticDependencies(NodeFactory) + 0x186
            at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1) + 0x3f
            at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependencies(DependencyNodeCore`1) + 0x33
            at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ProcessMarkStack() + 0xff
            at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() + 0x4f
            at ILCompiler.ILScanner.ILCompiler.IILScanner.Scan() + 0x19
            at ILCompiler.Program.<Run>g__RunScanner|4_0(Program.<>c__DisplayClass4_0&) + 0x1fa
            at ILCompiler.Program.Run() + 0x29cc
            at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass240_0.<.ctor>b__0(ParseResult result) + 0x35a

#103844 adds a test for this (disabled for Native AOT).

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Jun 21, 2024
Copy link
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

MichalStrehovsky added a commit to MichalStrehovsky/runtime that referenced this issue Jun 25, 2024
Do a couple more upfront checks to trigger exceptions when it's recoverable. Fixes dotnet#103843.

We still eventually crash when generating debug information since we don't have fine grained tracking of what parts of the type we looked at. The user would need to drop debug info generation, or stop feeding us garbage.
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Jun 26, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jul 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant