Skip to content
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

[DllImportGenerator] Update buffer size field for custom marshalling #63316

Merged
merged 3 commits into from
Jan 4, 2022

Conversation

elinor-fung
Copy link
Member

Update from #60374.

This is still always using stackalloc, so RequiresStackBuffer is not actually checked yet.

@AaronRobinsonMSFT @jkoritzinsky

@elinor-fung elinor-fung added area-System.Runtime.InteropServices source-generator Indicates an issue with a source generator feature labels Jan 3, 2022
@elinor-fung elinor-fung added this to the 7.0.0 milestone Jan 3, 2022
@ghost ghost assigned elinor-fung Jan 3, 2022
<value>A type that supports marshalling from managed to native using a caller-allocated buffer should also support marshalling from managed to native where using a caller-allocated buffer is impossible.</value>
</data>
<data name="CallerAllocMarshallingShouldSupportAllocatingMarshallingFallbackMessage" xml:space="preserve">
<value>Native type '{0}' has a constructor taking a caller-allocated buffer, but does not support marshalling in scenarios where using a caller-allocated buffer is impossible</value>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<value>Native type '{0}' has a constructor taking a caller-allocated buffer, but does not support marshalling in scenarios where using a caller-allocated buffer is impossible</value>
<value>Native type '{0}' has a constructor taking a caller-allocated buffer, but does not support marshalling in scenarios where using a caller-allocated buffer is impossible.</value>

Copy link
Member Author

Choose a reason for hiding this comment

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

Since it is a single sentence, I believe the message should not have the period (RS1032).

@@ -708,7 +708,8 @@ public Native(S s)

public S ToManaged() => new S { b = i != 0 };

public const int StackBufferSize = 1;
public const int BufferSize = 1;
public const bool RequiresStackBuffer = true;
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps a test with RequiresStackBuffer = false;?

@elinor-fung elinor-fung merged commit ef357af into dotnet:main Jan 4, 2022
@elinor-fung elinor-fung deleted the bufferSizeUpdate branch January 4, 2022 14:23
@ghost ghost locked as resolved and limited conversation to collaborators Feb 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Runtime.InteropServices source-generator Indicates an issue with a source generator feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants