This repository was archived by the owner on Sep 25, 2026. It is now read-only.
Repository navigation
Don't crash if pinvoke has a function pointer - #1350
Merged
Merged
Conversation
Linker tries to mark all instance fields on types referenced from p/invoke signatures but fails for function pointers because of a Cecil footgun (`TypeSpecification` has an `ElementType` property that is the actual element type for pointers/byrefs/arrays, is the generic definition for generic types, and `null` for pointer types). (We shouldn't actually need to mark the instance fields in the first place because these need to have a non-Auto layout but I digress.)
marek-safar
approved these changes
Jul 13, 2020
tkapin
pushed a commit
to tkapin/runtime
that referenced
this pull request
Jan 31, 2023
Linker tries to mark all instance fields on types referenced from p/invoke signatures but fails for function pointers because of a Cecil footgun (`TypeSpecification` has an `ElementType` property that is the actual element type for pointers/byrefs/arrays, is the generic definition for generic types, and `null` for pointer types). (We shouldn't actually need to mark the instance fields in the first place because these need to have a non-Auto layout but I digress.) Commit migrated from dotnet/linker@eaacef2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linker tries to mark all instance fields on types referenced from p/invoke signatures but fails for function pointers because of a Cecil footgun (
TypeSpecificationhas anElementTypeproperty that is the actual element type for pointers/byrefs/arrays, is the generic definition for generic types, andnullfor pointer types).(We shouldn't actually need to mark the instance fields in the first place because these need to have a non-Auto layout but I digress. If something actually needs that behavior, this is still buggy because it needs to happen recursively to actually work in interop, but CoreCLR would block Auto classes/structs right away.)
Fixes #1345.