-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[XC] fix compiled bindings containing arrays #25949
Conversation
don't get the property on the array type but on the element type - fixes #25819
@@ -1005,12 +1010,12 @@ static IEnumerable<Instruction> CompiledBindingGetHandlers(TypeReference tSource | |||
il.Emit(Ldarga_S, (byte)0); | |||
else | |||
il.Emit(Ldarg_0); | |||
var lastGetterTypeRef = properties[i - 1].property.PropertyType; | |||
var lastGetterTypeRef = properties[i - 1].property?.PropertyType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this and the next change are preventing the NRE reported as the issue
@@ -666,7 +666,12 @@ static bool TryParsePath(ILContext context, string path, TypeReference tSourceRe | |||
previousPartTypeRef = indexer.PropertyType.ResolveGenericParameters(indexerDeclTypeRef); | |||
} | |||
else | |||
{ | |||
if (previousPartTypeRef.IsArray) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this makes it produce valid, executable, and correct code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
With regards to the fix, is the first one fixing the issue, but the second chunk just stopping the crash even if we didn't fix it so we would rather have code that does nothing/something instead of crashing?
both are needed. the reported exception was a NRE, and the code should go through that null ref to end up on the actual fix. This is all strange, as this used to work, but the capability was somehow broken at some point, and we didn't had test for that part |
Description of Change
don't get the property on the array type but on the element type
Issues Fixed