Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

Fix bugs in static constructor #1

Merged
merged 3 commits into from
Nov 13, 2019
Merged

Fix bugs in static constructor #1

merged 3 commits into from
Nov 13, 2019

Conversation

bfriesen
Copy link
Contributor

In .NET Core 2.1 and above, the signature of the TypeArguments property of the internal ICSharpInvokeOrInvokeMemberBinder interface changed from IList<Type> to Type[]. What this boils down to is that generic arguments were not being captured in a small number of cases.

In .NET Core 3.0, static readonly fields are enforced by reflection. This caused the static constructor of UniversalMemberAccessor to throw a TypeInitializationException when it performed feature detection on whether modifying readonly fields is supported. The solution is to wrap the feature detection in try/catch blocks.

Brian Friesen added 3 commits November 13, 2019 11:36
In .NET Core 2.1 and above, the signature of the TypeArguments property of the internal ICSharpInvokeOrInvokeMemberBinder interface changed from IList<Type> to Type[]. What this boils down to is that generic arguments were not being captured in a small number of cases.

In the .NET Core 3.0, static readonly fields are enforced by reflection. This caused the static constructor of UniversalMemberAccessor to throw a TypeInitializationException when it performed feature detection on whether modifying readonly fields is supported. The solution is to wrap the feature detection in try/catch blocks.
Copy link
Contributor

@JustinMoss JustinMoss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phone call code review: 👍

@JustinMoss JustinMoss merged commit b0182a2 into master Nov 13, 2019
@JustinMoss JustinMoss deleted the readonly branch November 13, 2019 20:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants