-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
I recently tried to generate bindings for a library that uses System.Linq.Expressions. However, Beyond.NET generated wrappers for several properties which are included in the runtime and technically public, but not included in the reference assembly.
For example, it tried to generate a wrapper for LambdaExpression.CanCompileToIL, which is defined like this in the System.Linq.Expressions source code:
[FeatureGuard(typeof(RequiresDynamicCodeAttribute))]
public static bool CanCompileToIL => RuntimeFeature.IsDynamicCodeSupported;But it's not included in the corresponding reference assembly. So, the wrapper fails to compile with the following error:
error CS0117: 'LambdaExpression' does not contain a definition for 'CanCompileToIL'
Generated code
internal unsafe class System_Linq_Expressions_LambdaExpression
{
[UnmanagedCallersOnly(EntryPoint = "System_Linq_Expressions_LambdaExpression_CanCompileToIL_Get")]
internal static byte /* System.Boolean */ System_Linq_Expressions_LambdaExpression_CanCompileToIL_Get(void** /* System.Exception */ __outException)
{
try {
System.Boolean __returnValue = System.Linq.Expressions.LambdaExpression.CanCompileToIL;
byte __returnValueNative = __returnValue.ToCBool();
if (__outException is not null) {
*__outException = null;
}
return __returnValueNative;
} catch (Exception __exception) {
if (__outException is not null) {
void* __exceptionHandleAddress = __exception.AllocateGCHandleAndGetAddress();
*__outException = __exceptionHandleAddress;
}
return 0;
} finally {
}
}
}Attempting to exclude this type via the JSON config file causes an early error in Beyond.NET.
Metadata
Metadata
Assignees
Labels
No labels