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

net6.0-ios: AOT compiler fail when UnmanagedCallersOnly has CallConvs #75700

Closed
ericsink opened this issue Sep 15, 2022 · 3 comments
Closed

net6.0-ios: AOT compiler fail when UnmanagedCallersOnly has CallConvs #75700

ericsink opened this issue Sep 15, 2022 · 3 comments
Assignees
Milestone

Comments

@ericsink
Copy link

Description

We have a case where including CallConvs in an UnmanagedCallersOnly attribute causes the AOT compiler to fail.

This works:

using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

public static class foo
{
        [UnmanagedCallersOnly]
        public static void fun(IntPtr p, int t)
        {
        }
}

but this one fails:

using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

public static class foo
{
        [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
        public static void fun(IntPtr p, int t)
        {
        }
}

with this error:

eric@Erics-MacBook-Pro test % dotnet build
MSBuild version 17.3.0+92e077650 for .NET
  Determining projects to restore...
  Restored /Users/eric/Downloads/test/test.csproj (in 125 ms).
  Detected signing identity: (omitted)

  test -> /Users/eric/Downloads/test/bin/Debug/net6.0-ios/ios-arm64/test.dll
  Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
  Tool /usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-x64.Cross.ios-arm64/6.0.8/Sdk/../tools/mono-aot-cross execution finished (exit code = 134).

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/15.4.447/targets/Xamarin.Shared.Sdk.targets(1000,3): error : Failed to AOT compile test.dll, the AOT compiler exited with code 134 [/Users/eric/Downloads/test/test.csproj]

Build FAILED.

Reproduction Steps

issue516_repro.zip

Expected behavior

The build should succeed

Actual behavior

The AOT compiler fails with error code 134.

Regression?

No response

Known Workarounds

No response

Configuration

eric@Erics-MacBook-Pro test % dotnet --version
6.0.400

Other information

Originally found:

ericsink/SQLitePCL.raw#516

@SamMonoRT
Copy link
Member

SamMonoRT commented Sep 19, 2022

@ivanpovazan suggested this was fixed by #69759 for .NET 7.0 - We don't intend to backport to 6.0. Marking issue as 8.0 for validation

@SamMonoRT SamMonoRT added this to the 8.0.0 milestone Sep 19, 2022
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Sep 19, 2022
@ivanpovazan
Copy link
Member

cc @LeVladIonescu

@LeVladIonescu
Copy link
Contributor

Validated fixes from #69759 using the following dotnet versions:

  • 8.0.100-alpha.1.22567.28
  • 7.0.100-rc.1.22431.12

AOT compilation passes for CallConvs included in an UnmanagedCallersOnly attribute.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants