You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When "cross compiling" a script for a corlib different from the "host", if a return type is not specified, System.Object from the host (via typeof(object)) is reflection-loaded.
This makes it impossible to target a script on a different corlib (e.g. Xamarin.iOS) from the host without explicitly specifying a returnType: via CreateScriptCompilation.
(1,1): error CS0400: The type or namespace name 'System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' could not be found in the global namespace (are you missing an assembly reference?)
This is due to the compilation falling back (because returnType: is not specified via CreateScriptCompilation) to typeof(object) for SynthesizedInteractiveInitializerMethod's Task<> return type type argument, which will be the host corlib's System.Object and not the System.Object from the Xamarin.iOS (or any other non-host-compatible) corlib.
The text was updated successfully, but these errors were encountered:
I've just finally gotten around to updating #8507 to account for the last round of feedback and rebased it on today's master. I hope we can get this merged. We need this in Xamarin Workbooks and have been shipping a patched version of Roslyn with the patch since February.
When "cross compiling" a script for a corlib different from the "host", if a return type is not specified,
System.Object
from the host (viatypeof(object)
) is reflection-loaded.This makes it impossible to target a script on a different corlib (e.g. Xamarin.iOS) from the host without explicitly specifying a
returnType:
viaCreateScriptCompilation
.Example:
This will result in the diagnostic:
This is due to the compilation falling back (because
returnType:
is not specified viaCreateScriptCompilation
) totypeof(object)
forSynthesizedInteractiveInitializerMethod
'sTask<>
return type type argument, which will be the host corlib'sSystem.Object
and not theSystem.Object
from the Xamarin.iOS (or any other non-host-compatible) corlib.The text was updated successfully, but these errors were encountered: