Skip to content

Commit 1f9d221

Browse files
committed
fixup! Workaround for mono attribute bug
don't try to derive from sealed types
1 parent d2f1ab6 commit 1f9d221

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/runtime/StateSerialization/RuntimeData.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ internal static class NonSerializedTypeBuilder
4444
private static Func<Type, bool> isNestedType = (tp) => hasVisibility(tp, TypeAttributes.NestedPrivate) || hasVisibility(tp, TypeAttributes.NestedPublic) || hasVisibility(tp, TypeAttributes.NestedFamily) || hasVisibility(tp, TypeAttributes.NestedAssembly);
4545
private static Func<Type, bool> isPrivateType = (tp) => hasVisibility(tp, TypeAttributes.NotPublic) || hasVisibility(tp, TypeAttributes.NestedPrivate) || hasVisibility(tp, TypeAttributes.NestedFamily) || hasVisibility( tp, TypeAttributes.NestedAssembly);
4646
private static Func<Type, bool> isPublicType = (tp) => hasVisibility(tp, TypeAttributes.Public) || hasVisibility(tp,TypeAttributes.NestedPublic);
47+
private static Func<Type, bool> CanCreateType = (tp) => isPublicType(tp) && ((tp.Attributes & TypeAttributes.Sealed) == 0);
4748

4849
public static object? CreateNewObject(Type baseType)
4950
{
@@ -108,7 +109,7 @@ static string MakeName(Type tp)
108109

109110
public static Type? CreateType(Type tp)
110111
{
111-
if (!isPublicType(tp))
112+
if (!CanCreateType(tp))
112113
{
113114
return null;
114115
}

0 commit comments

Comments
 (0)