Using InlineMethod.Fody 0.7.2 and Fody 6.8.1 on .NET 8. The below code throws a System.FieldAccessException because Clear is inlined. It makes sense to me why the runtime might enforce access restrictions that cause this exception. But the method should not be inlined in a case like this and a warning should be issued that it can't be inlined because it would access an inaccessible field.
using System.Collections.Generic;
using InlineMethod;
public class Example
{
private List<int> values = new();
[Inline]
public void Clear() => values.Clear();
}
public class User
{
public void Caller() => new Example().Clear();
}
Exception:
System.FieldAccessException
Attempt by method 'User.Caller()' to access field 'Example.values' failed.
at User.Caller() in C:\dataFast\azoth-lang\azoth.tools.bootstrap\Compiler.Core\Attributes\User.cs:line 14
Using
InlineMethod.Fody
0.7.2 and Fody6.8.1
on .NET 8. The below code throws aSystem.FieldAccessException
becauseClear
is inlined. It makes sense to me why the runtime might enforce access restrictions that cause this exception. But the method should not be inlined in a case like this and a warning should be issued that it can't be inlined because it would access an inaccessible field.Exception: