corert icon indicating copy to clipboard operation
corert copied to clipboard

Interop runtime exception error messages need to be localized

Open shrah opened this issue 9 years ago • 1 comments

The runtime exception messages for P/Invokes with unsupported signatures or bad MarshalAs directives are hardcoded. Those strings need to be localized.

shrah avatar Feb 07 '17 19:02 shrah

As per Michal's Suggestion:

  1. Throw the same exception type the CLR would throw (does interop really throw System.Exception when someone messes up their P/invoke declaration?)
  2. Get the exception message from the class library. This is needed for glob/loc - the localization of the compiler and the localization of the class library are decoupled. E.g. see TypeSystemThrowingILEmitter how we solve this for type system exception messages (e.g. when someone tries to put an explicit structlayout on a generic type and allocate such thing, they'll get a runtime exception with a message that comes from the classlib).

shrah avatar Feb 07 '17 19:02 shrah