Skip to content

fix: StaticFieldsAndPropertiesCanBeParams+InProcessEmitToolchain test issue#3119

Merged
timcassell merged 1 commit into
dotnet:masterfrom
filzrev:fix-issue-3118
May 8, 2026
Merged

fix: StaticFieldsAndPropertiesCanBeParams+InProcessEmitToolchain test issue#3119
timcassell merged 1 commit into
dotnet:masterfrom
filzrev:fix-issue-3118

Conversation

@filzrev
Copy link
Copy Markdown
Contributor

@filzrev filzrev commented May 8, 2026

This PR intended to fix #3118

What's changed in this PR

Add BindingFlags.FlattenHierarchy to reflection logics on RunnableReflectionHelpers.SetParameter.

Currently, it failed to resolve inherited static property/field on following lines.

if (type.GetProperty(paramInfo.Name, bindingFlags) is var p && p != null)
{
p.SetValue(instanceArg, TryChangeType(paramInfo.Value, p.PropertyType));
}
else if (type.GetField(paramInfo.Name, bindingFlags) is var f && f != null)
{
f.SetValue(instanceArg, TryChangeType(paramInfo.Value, f.FieldType));
}

By this change, It can resolve inherited static property/field.
https://learn.microsoft.com/en-us/dotnet/api/system.reflection.bindingflags?view=net-8.0#fields

Test

Currently, test behavior is confirmed local environment.
I'll modify ParamsTests to use InProcessToolchain on another PR (Reduce CI execution time).

@timcassell timcassell merged commit c361cb8 into dotnet:master May 8, 2026
11 checks passed
@timcassell timcassell added this to the v0.16.0 milestone May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WithStaticParams test failed when using InProcessEmitToolchain

2 participants