-
Notifications
You must be signed in to change notification settings - Fork 5k
[NativeAOT][iOS] App Hangs/Freezes with Static Virtual Properties in Interfaces on .NET 9 #113423
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
Comments
Tagging subscribers to 'os-ios': @vitek-karas, @kotlarmilos, @ivanpovazan, @steveisok, @akoeplinger |
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas |
This looks like another instance of #110932 that we fixed in #111030; doesn't repro with .NET 10 builds. Non-apple repro: MainController ctrl = new MainController();
ctrl.ViewDidLoad();
public class Test : ITestInterface<Test>
{
public static bool Flag => true;
}
public interface ITestInterface<in TRequest>
where TRequest : ITestInterface<TRequest>
{
protected static virtual bool Flag => false;
public static virtual void Invoke(TRequest request)
{
if (TRequest.Flag)
Console.WriteLine("flag=true");
}
}
public class MainController
{
public void ViewDidLoad()
{
Console.WriteLine("Begin Invoke");
Invoke(new Test());
Console.WriteLine("End Invoke");
}
public static void Invoke<TRequest>(TRequest request)
where TRequest : ITestInterface<TRequest>
=> TRequest.Invoke(request);
} |
Fix was merged to 9.0 staging branch in #113462. |
Description
When migrating an iOS project from .NET 8 NativeAOT to .NET 9 NativeAOT, the application hangs (appears to deadlock) without throwing any exceptions or generating error logs. After significant troubleshooting, the issue was traced to the use of a static virtual property within an interface. In .NET 9, the following simplified code consistently reproduces the hang, whereas it works as expected under .NET 8.
Reproduction Steps
Expected behavior
The application should start normally and display the log messages:
Actual behavior
The application hangs (freezes) with no console output beyond Begin Invoke, and no exceptions are thrown. Execution never reaches
flag=true
orEnd Invoke
.Regression?
This issue does not appear on .NET 8; it only occurs after upgrading to .NET 9.
Known Workarounds
If I change the property to abstract, it works.
If I change the property to method
protected static virtual bool GetFlag() => false;
, it works.Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: