Skip to content

Conversation

@jpobst
Copy link
Contributor

@jpobst jpobst commented Jan 5, 2021

Fixes: #763

Today we generate this code:

throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", JNIEnv.GetClassNameFromInstance (handle), "java.code.IMyInterface"));

In newer CSC versions (.NET5+), this produces a CA1305 warning. We can avoid this warning with string interpolation:

throw new InvalidCastException ($"Unable to convert instance of type '{JNIEnv.GetClassNameFromInstance (handle)}' to type 'java.code.IMyInterface'.");

@jpobst jpobst marked this pull request as ready for review January 5, 2021 21:32
@radekdoulik radekdoulik merged commit f1b9365 into master Jan 6, 2021
@radekdoulik radekdoulik deleted the ca1305 branch January 6, 2021 10:04
@jpobst jpobst added this to the 11.2 (16.10 / 8.10) milestone Feb 2, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generated invoker code causes CA1305 warning

3 participants