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

[runtime] Fix Mono BStr marshaling, cleanup IL generation #35804

Merged
merged 10 commits into from
May 28, 2020

Conversation

CoffeeFlux
Copy link
Contributor

@CoffeeFlux CoffeeFlux commented May 4, 2020

This PR checks in recent string marshaling work and enables a subset of tests that now run successfully. It's possible that this fixes or changes the failure on other tests, but I've only checked the StringMarshalling ones.

Status of string marshaling of this PR:

  • AnsiBStr - tests pass
  • BStr - tests pass
  • LPStr - failure with StringBuilder
  • LPTStr - immediate failure
  • UTF8Str - crash with invalid malloc in StringBuilder code (??)
  • LPWStr - no tests
  • TBStr - no tests

Followup work:

  • Fix UTF8 crash (probably corruption, the crash used to be in a free call)
  • Clean up StringBuilder code (lots of issues, some caught by the tests, in progress)
  • Add TBStr and LPWStr tests (in progress)
  • Fix LPTStr to properly handle both ANSI and UTF16 text (or maybe change the test to align with our historical behavior? currently the test uses LPWStr on all platforms)
  • Add a wall of text on string marshaling behavior for classic and netcore Mono at the start of conv_to_icall

@alexischr
Copy link
Contributor

https://docs.microsoft.com/en-us/previous-versions/windows/desktop/automat/bstr has BSTR always have a four-byte integer for the length. Is this a "different" BSTR?

Copy link
Member

@lambdageek lambdageek left a comment

Choose a reason for hiding this comment

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

LGTM, in general.

Nits:

  1. It'd be great to have a wall of text somewhere summarizing the string types and how we choose to marshal them in (netcore & classic) Mono
  2. Address Alexis' (guint32*)s - 2 comment
  3. Maybe bstr_set_length as a little helper to collect the pointer arithmetic.

I like conv_str_inverse

@CoffeeFlux CoffeeFlux merged commit bac8819 into dotnet:master May 28, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants