Output: Ignore static and non-public constructors when determining if an attribute should be commented out (CS7036)

This commit is contained in:
Katy Coe
2019-12-11 10:47:20 +01:00
parent b8df3d7100
commit ffb1ebced7

View File

@@ -20,7 +20,7 @@ namespace Il2CppInspector.Reflection
foreach (var cad in attributes) {
// Find a constructor that either has no parameters, or all optional parameters
var parameterlessConstructor = cad.AttributeType.DeclaredConstructors.Any(c => c.DeclaredParameters.All(p => p.IsOptional));
var parameterlessConstructor = cad.AttributeType.DeclaredConstructors.Any(c => !c.IsStatic && c.IsPublic && c.DeclaredParameters.All(p => p.IsOptional));
// IL2CPP doesn't retain attribute arguments so we have to comment out those with non-optional arguments if we want the output to compile
var commentStart = mustCompile && !parameterlessConstructor? inline? "/* " : "// " : "";