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.
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
Address some System.Formats.Tar TODOs (infra and syscalls) #69107
Address some System.Formats.Tar TODOs (infra and syscalls) #69107
Changes from 18 commits
c178925
9f020bd
c4d444b
354e40a
d04ec6b
9cb26f1
d94536a
cdbbddf
e343a3b
1af51df
d845d56
94d2cf0
90cc58c
fe9a927
a8f5cf6
498c084
7b4e7b5
a9090b4
7c01996
8de50ad
31ab76b
67fe812
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the StringMarshalling know that it should free the
char*
that comes back from the native method?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From looking at the generated code in ILSpy, it looks like it does:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AaronRobinsonMSFT @elinor-fung @jkoritzinsky - for my knowledge, if I have a P/Invoke where the returned string is shared and shouldn't be free'd, how would I write that? Just return the
byte*
pointer in my method and handle it myself? Or is there some built-in way to tell the marshalling code to not free the buffer?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be a special case and I'm dubious if it is all that common. There is no support for that with the source generator marshallers nor in the built-in marshallers. Feel free to file an issue on that and we can consider it. Full-disclosure, if there isn't a lot of traction on it we'd likely close it at the end of the .NET 8 cycle.
That would be the easiest way to handle this case. Another way would be to copy the appropriate "StringMarshaller" type from source into the project and modify it as desired.