Description
Description
When using an enum for a SizeParamIndex using Mono runtime, the following exception will be thrown:
MarshalDirectiveException: Array size control parameter must be an integral type.
In src/tests/ I searched for SizeParamIndex and found no test which used an enum for it.
EDIT: I think related is #35225 which covers interop tests which fail in Mono runtime but pass in CoreCLR, but a test doesn't currently exist for this enum issue.
Background context
I found this problem when building and running OmniSharp, which surfaces there in the use of microsoft/MSBuildLocator. Relevant MSBuildLocator code here:
https://github.com/microsoft/MSBuildLocator/blob/0bbf4988996176904ecc0dabb73165919fac605f/src/MSBuildLocator/NativeMethods.cs#L32
Reproduction Steps
Modify a test to use an enum for SizeParamIndex and test on Mono runtime.
Expected behavior
No exception. microsoft/MSBuildLocator wrote in issues that Mono isn't supported, it works fine on CoreCLR.
Actual behavior
See above MarshalDirectiveException.
Regression?
No response
Known Workarounds
No response
Configuration
dotnet core compiled with --use-mono-runtime
.
On Android using Termux.
Other information
I think it is a one line fix, add case MONO_TYPE_ENUM
to the switch here:
runtime/src/mono/mono/component/marshal-ilgen.c
Lines 474 to 487 in 1713d65
And add a SizeParamIndex test which uses an enum.
Metadata
Metadata
Assignees
Type
Projects
Status