You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[mono] class-setup-vtable.c:1747, condition `is_ok (error)' not met, function:mono_class_setup_vtable_general, VAR 1 (T) cannot be expanded in this context with 1 instantiations #61244
Using Blazor WebAssembly project. I have a class hierarchy that seems to cause an assertion failure in the mono runtime. I've created a solution and reduced the code as much as I can and attached it to this issue. The project works fine in a Blazor Server (non-WebAssembly) project.
The projects were created with Visual Studio 2022 using the 6.0.100-rc.2.21505.57 SDK.
A little more information: I tried with the latest .Net 6 SDK release (6.0.100) and the problem persists.
I attempted to work around the issue by adding <RunAOTCompilation>true</RunAOTCompilation> to the .Client project and it resulted in the following error.
Assertion at D:\a\_work\1\s\src\mono\mono\metadata\class-setup-vtable.c:1747, condition `is_ok (error)' not met, function:mono_class_setup_vtable_general, VAR 1 (T) cannot be expanded in this context with 1 instantiations
It's the override that implements ComfileTech.Framework.IGetSetChangeValue`1<T>:add_Changing (System.Action`1<ComfileTech.Framework.IChangeEventArgs`2<ComfileTech.Framework.IGetSetChangeValue`1<T>, T>>) with ComfileTech.Framework.IGetSetChangeValue`2:ComfileTech.Framework.IGetSetChangeValue<T>.add_Changing (System.Action`1<ComfileTech.Framework.IChangeEventArgs`2<ComfileTech.Framework.IGetSetChangeValue`1<T>, T>>)
ie, it's here:
publicinterfaceIGetSetChangeValue<outTProperty,T>:IGetChangeValue<TProperty,T>,IGetSetChangeValue<T>whereTProperty:IGetSetChangeValue<TProperty,T>{neweventAction<IChangeEventArgs<TProperty,T>>?Changing;neweventAction<IChangeEventArgs<TProperty,T>>?Changed;eventAction<IChangeEventArgs<IGetSetChangeValue<T>,T>>?IGetSetChangeValue<T>.Changing{add{Changing+=(Action<IChangeEventArgs<TProperty,T>>?)value;}// this overrideremove{Changing-=(Action<IChangeEventArgs<TProperty,T>>?)value;}}
changed the title [-]Blazor WebAssembly: Assertion at /__w/1/s/src/mono/mono/metadata/class-setup-vtable.c:1747[/-][+][mono] class-setup-vtable.c:1747, condition `is_ok (error)' not met, function:mono_class_setup_vtable_general, VAR 1 (T) cannot be expanded in this context with 1 instantiations[/+]on Nov 10, 2021
I've also encountered this issue. When trying to understand what causes this so I could know what to change in the project I'm writing until this gets fixed, I've condensed the above shorter repro into an even shorter one. In case it helps, I figured I'd post it.
public interface I1<T>
{
void Foo();
}
public interface I2<T, T2> : I1<T>
{
void I1<T>.Foo()
{
Console.WriteLine("Error not reproduced");
}
}
public class C : I2<int, int>
{
}
public class Program
{
public static void Main()
{
var isMono = typeof(object).Assembly.GetType("Mono.RuntimeStructs") != null;
Console.WriteLine($"isMono = {isMono}");
I1<int> v = new C();
v.Foo();
}
}
If I remove either of the type variables in I2 or move the implementation of Foo in I2 to either I1 or C, the error doesn't occur.
Activity
lewing commentedon Nov 5, 2021
cc @lambdageek
JinShil commentedon Nov 10, 2021
A little more information: I tried with the latest .Net 6 SDK release (6.0.100) and the problem persists.
I attempted to work around the issue by adding
<RunAOTCompilation>true</RunAOTCompilation>to the.Clientproject and it resulted in the following error.lambdageek commentedon Nov 10, 2021
Standalone console repro https://gist.github.com/lambdageek/f0492bf5c890280943ca93ff0cef227d - there's probably more code that can be removed
lambdageek commentedon Nov 10, 2021
It's the override that implements
ComfileTech.Framework.IGetSetChangeValue`1<T>:add_Changing (System.Action`1<ComfileTech.Framework.IChangeEventArgs`2<ComfileTech.Framework.IGetSetChangeValue`1<T>, T>>)withComfileTech.Framework.IGetSetChangeValue`2:ComfileTech.Framework.IGetSetChangeValue<T>.add_Changing (System.Action`1<ComfileTech.Framework.IChangeEventArgs`2<ComfileTech.Framework.IGetSetChangeValue`1<T>, T>>)ie, it's here:
lambdageek commentedon Nov 10, 2021
Shorter repro
(with these additions to the .csproj)
[-]Blazor WebAssembly: Assertion at /__w/1/s/src/mono/mono/metadata/class-setup-vtable.c:1747[/-][+][mono] class-setup-vtable.c:1747, condition `is_ok (error)' not met, function:mono_class_setup_vtable_general, VAR 1 (T) cannot be expanded in this context with 1 instantiations[/+]matthewslesinski commentedon Dec 9, 2021
I've also encountered this issue. When trying to understand what causes this so I could know what to change in the project I'm writing until this gets fixed, I've condensed the above shorter repro into an even shorter one. In case it helps, I figured I'd post it.
If I remove either of the type variables in I2 or move the implementation of Foo in I2 to either I1 or C, the error doesn't occur.
JamesYFC commentedon Jan 12, 2022
In Unity's Mono at least, I don't even need to call
Foo()to get this error. Just the instantiation line will trigger it.vtable setup fix for generic default interface methods in mono runtime
vtable setup fix for generic default interface methods in mono runtime
vtable setup fix for generic default interface methods in mono runtime
vtable setup fix for generic default interface methods in mono runtime (
vtable setup fix for generic default interface methods in mono runtime (
vtable setup fix for generic default interface methods in mono runtime
vtable setup fix for generic default interface methods in mono runtime
vtable setup fix for generic default interface methods in mono runtime (