[net8.0] Merge main into net8.0.
This commit is contained in:
Коммит
ac90c511d1
|
@ -23,8 +23,9 @@ jobs:
|
|||
set -ex
|
||||
git config user.email "github-actions-single-platform-branch-updater@xamarin.com"
|
||||
git config user.name "GitHub Actions Single Platform Branch Updater"
|
||||
for platform in iOS tvOS MacCatalyst macOS; do
|
||||
git checkout -b release-test/only-dotnet-$platform origin/release-test/only-dotnet-$platform
|
||||
for platform in dotnet-iOS dotnet-tvOS dotnet-MacCatalyst dotnet-macOS dotnet legacy legacy-iOS legacy-macOS; do
|
||||
git checkout -b release-test/only-$platform origin/release-test/only-$platform
|
||||
git merge origin/main
|
||||
git push
|
||||
done
|
||||
|
||||
|
|
12
Make.config
12
Make.config
|
@ -40,12 +40,12 @@ $(TOP)/Make.config.inc: $(TOP)/Make.config $(TOP)/mk/mono.mk
|
|||
|
||||
include $(TOP)/Make.versions
|
||||
|
||||
APIDIFF_REFERENCES_iOS=https://dl.internalx.com/wrench/xcode14.1/6714e055b242715aaa682b578f898070facf243a/7021940/package/bundle.zip
|
||||
APIDIFF_REFERENCES_Mac=https://dl.internalx.com/wrench/xcode14.1/6714e055b242715aaa682b578f898070facf243a/7021940/package/bundle.zip
|
||||
APIDIFF_REFERENCES_DOTNET_iOS=https://dl.internalx.com/wrench/7.0.1xx/c51a20dbde7bb30d896019f178e0055559071177/6999758/package/bundle.zip
|
||||
APIDIFF_REFERENCES_DOTNET_tvOS=https://dl.internalx.com/wrench/7.0.1xx/c51a20dbde7bb30d896019f178e0055559071177/6999758/package/bundle.zip
|
||||
APIDIFF_REFERENCES_DOTNET_macOS=https://dl.internalx.com/wrench/7.0.1xx/c51a20dbde7bb30d896019f178e0055559071177/6999758/package/bundle.zip
|
||||
APIDIFF_REFERENCES_DOTNET_MacCatalyst=https://dl.internalx.com/wrench/7.0.1xx/c51a20dbde7bb30d896019f178e0055559071177/6999758/package/bundle.zip
|
||||
APIDIFF_REFERENCES_iOS=https://dl.internalx.com/wrench/xcode14.3/97731c92cc6d147825c1a39ed2c5c530a5f9a12b/7611701/package/bundle.zip
|
||||
APIDIFF_REFERENCES_Mac=https://dl.internalx.com/wrench/xcode14.3/97731c92cc6d147825c1a39ed2c5c530a5f9a12b/7611701/package/bundle.zip
|
||||
APIDIFF_REFERENCES_DOTNET_iOS=https://dl.internalx.com/wrench/7.0.3xx/43ae6c749407e47fdf5fa07295119b87f7328ea6/8004688/package/bundle.zip
|
||||
APIDIFF_REFERENCES_DOTNET_tvOS=https://dl.internalx.com/wrench/7.0.3xx/43ae6c749407e47fdf5fa07295119b87f7328ea6/8004688/package/bundle.zip
|
||||
APIDIFF_REFERENCES_DOTNET_macOS=https://dl.internalx.com/wrench/7.0.3xx/43ae6c749407e47fdf5fa07295119b87f7328ea6/8004688/package/bundle.zip
|
||||
APIDIFF_REFERENCES_DOTNET_MacCatalyst=https://dl.internalx.com/wrench/7.0.3xx/43ae6c749407e47fdf5fa07295119b87f7328ea6/8004688/package/bundle.zip
|
||||
|
||||
PACKAGE_HEAD_REV=$(shell git rev-parse HEAD)
|
||||
|
||||
|
|
|
@ -1019,11 +1019,15 @@
|
|||
<_IsDedupEnabled Condition="'$(_IsDedupEnabled)' == ''">true</_IsDedupEnabled>
|
||||
<_DedupAssembly Condition="'$(_RunAotCompiler)' == 'true' And '$(IsMacEnabled)' == 'true' And '$(_IsDedupEnabled)' == 'true'">$(IntermediateOutputPath)aot-instances.dll</_DedupAssembly>
|
||||
|
||||
<!-- default to 'static' for Mac Catalyst to work around https://github.com/xamarin/xamarin-macios/issues/14686 -->
|
||||
<_LibMonoLinkMode Condition="'$(_LibMonoLinkMode)' == '' And '$(_PlatformName)' == 'MacCatalyst'">static</_LibMonoLinkMode>
|
||||
<_LibMonoLinkMode Condition="'$(_LibMonoLinkMode)' == '' And ('$(ComputedPlatform)' != 'iPhone' Or '$(_PlatformName)' == 'macOS')">dylib</_LibMonoLinkMode>
|
||||
<_LibMonoLinkMode Condition="'$(_LibMonoLinkMode)' == ''">static</_LibMonoLinkMode>
|
||||
<_LibMonoExtension Condition="'$(_LibMonoLinkMode)' == 'dylib'">dylib</_LibMonoExtension>
|
||||
<_LibMonoExtension Condition="'$(_LibMonoLinkMode)' == 'static'">a</_LibMonoExtension>
|
||||
|
||||
<!-- default to 'static' for Mac Catalyst to work around https://github.com/xamarin/xamarin-macios/issues/14686 -->
|
||||
<_LibXamarinLinkMode Condition="'$(_LibXamarinLinkMode)' == '' And '$(_PlatformName)' == 'MacCatalyst'">static</_LibXamarinLinkMode>
|
||||
<_LibXamarinLinkMode Condition="'$(_LibXamarinLinkMode)' == '' And '$(ComputedPlatform)' != 'iPhone' And '$(_PlatformName)' != 'macOS'">dylib</_LibXamarinLinkMode>
|
||||
<_LibXamarinLinkMode Condition="'$(_LibXamarinLinkMode)' == ''">static</_LibXamarinLinkMode>
|
||||
<_LibXamarinExtension Condition="'$(_LibXamarinLinkMode)' == 'dylib'">dylib</_LibXamarinExtension>
|
||||
|
|
|
@ -13,7 +13,11 @@ namespace ObjCRuntime {
|
|||
get { return handle; }
|
||||
}
|
||||
|
||||
#if XAMCORE_5_0
|
||||
public readonly static NativeHandle Zero = default (NativeHandle);
|
||||
#else
|
||||
public static NativeHandle Zero = default (NativeHandle);
|
||||
#endif
|
||||
|
||||
public NativeHandle (IntPtr handle)
|
||||
{
|
||||
|
|
|
@ -2294,7 +2294,11 @@ namespace SpriteKit {
|
|||
SKAction FollowPath (CGPath path, double sec);
|
||||
|
||||
[Static, Export ("followPath:asOffset:orientToPath:duration:")]
|
||||
#if XAMCORE_5_0
|
||||
SKAction FollowPath (CGPath path, bool offset, bool orientToPath, double sec);
|
||||
#else
|
||||
SKAction FollowPath (CGPath path, bool offset, bool orient, double sec);
|
||||
#endif
|
||||
|
||||
[MacCatalyst (13, 1)]
|
||||
[Static, Export ("followPath:speed:")]
|
||||
|
@ -2302,7 +2306,11 @@ namespace SpriteKit {
|
|||
|
||||
[MacCatalyst (13, 1)]
|
||||
[Static, Export ("followPath:asOffset:orientToPath:speed:")]
|
||||
#if XAMCORE_5_0
|
||||
SKAction FollowPath (CGPath path, bool offset, bool orientToPath, nfloat speed);
|
||||
#else
|
||||
SKAction FollowPath (CGPath path, bool offset, bool orient, nfloat speed);
|
||||
#endif
|
||||
|
||||
[Static, Export ("speedBy:duration:")]
|
||||
SKAction SpeedBy (nfloat speed, double sec);
|
||||
|
|
|
@ -196,7 +196,12 @@ namespace Xamarin.Tests {
|
|||
|
||||
public static IEnumerable<BuildLogEvent> GetBuildLogWarnings (string path)
|
||||
{
|
||||
return GetBuildMessages (path).Where (v => v.Type == BuildLogEventType.Warning);
|
||||
return GetBuildMessages (path)
|
||||
// Filter to warnings
|
||||
.Where (v => v.Type == BuildLogEventType.Warning)
|
||||
// We're often referencing earlier .NET projects (Touch.Unit/MonoTouch.Dialog), so ignore any out-of-support warnings.
|
||||
.Where (v => v.Message?.Contains ("is out of support and will not receive security updates in the future") != true)
|
||||
;
|
||||
}
|
||||
|
||||
public static IEnumerable<BuildLogEvent> GetBuildLogErrors (string path)
|
||||
|
|
|
@ -180,6 +180,7 @@ namespace Xamarin.Tests {
|
|||
}
|
||||
if (test_config.Any ())
|
||||
ParseConfigFiles (test_config);
|
||||
ParseConfigFiles (FindConfigFiles ("configure.inc"));
|
||||
ParseConfigFiles (FindConfigFiles ("Make.config.local"));
|
||||
ParseConfigFiles (FindConfigFiles ("Make.config"));
|
||||
}
|
||||
|
@ -195,7 +196,7 @@ namespace Xamarin.Tests {
|
|||
if (string.IsNullOrEmpty (file))
|
||||
return;
|
||||
|
||||
foreach (var line in File.ReadAllLines (file)) {
|
||||
foreach (var line in File.ReadAllLines (file).Reverse ()) {
|
||||
var eq = line.IndexOf ('=');
|
||||
if (eq == -1)
|
||||
continue;
|
||||
|
|
|
@ -187,6 +187,21 @@ namespace Xamarin.Tests {
|
|||
var outputStr = output.ToString ();
|
||||
Console.WriteLine ($"'{Executable} {StringUtils.FormatArguments (args)}' failed with exit code {rv.ExitCode}.");
|
||||
Console.WriteLine (outputStr);
|
||||
if (rv.ExitCode != 0) {
|
||||
var msg = new StringBuilder ();
|
||||
msg.AppendLine ($"'dotnet {verb}' failed with exit code {rv.ExitCode}");
|
||||
msg.AppendLine ($"Full command: {Executable} {StringUtils.FormatArguments (args)}");
|
||||
#if !MSBUILD_TASKS
|
||||
var errors = BinLog.GetBuildLogErrors (binlogPath).ToArray ();
|
||||
if (errors.Any ()) {
|
||||
var errorsToList = errors.Take (10).ToArray ();
|
||||
msg.AppendLine ($"Listing first {errorsToList.Length} error(s) (of {errors.Length} error(s)):");
|
||||
foreach (var error in errorsToList)
|
||||
msg.AppendLine ($" {string.Join ($"{Environment.NewLine} ", error.ToString ().Split ('\n', '\r'))}");
|
||||
}
|
||||
#endif
|
||||
Assert.Fail (msg.ToString ());
|
||||
}
|
||||
Assert.AreEqual (0, rv.ExitCode, $"Exit code: {Executable} {StringUtils.FormatArguments (args)}");
|
||||
}
|
||||
return new ExecutionResult (output, output, rv.ExitCode) {
|
||||
|
|
|
@ -1231,15 +1231,6 @@ namespace Xamarin.Tests {
|
|||
var signedDylibs = new List<string> {
|
||||
Path.Combine (sharedSupportDir, "app2.app", dylibDir, "lib2.dylib"),
|
||||
};
|
||||
if (platform == ApplePlatform.MacCatalyst) {
|
||||
signedDylibs.Add (Path.Combine (dylibDir, "libSystem.Globalization.Native.dylib"));
|
||||
signedDylibs.Add (Path.Combine (dylibDir, "libSystem.IO.Compression.Native.dylib"));
|
||||
signedDylibs.Add (Path.Combine (dylibDir, "libSystem.Native.dylib"));
|
||||
signedDylibs.Add (Path.Combine (dylibDir, "libSystem.Net.Security.Native.dylib"));
|
||||
signedDylibs.Add (Path.Combine (dylibDir, "libSystem.Security.Cryptography.Native.Apple.dylib"));
|
||||
signedDylibs.Add (Path.Combine (dylibDir, "libmonosgen-2.0.dylib"));
|
||||
signedDylibs.Add (Path.Combine (dylibDir, "libxamarin-dotnet-debug.dylib"));
|
||||
}
|
||||
|
||||
foreach (var dylib in signedDylibs) {
|
||||
var path = Path.Combine (appPath, dylib);
|
||||
|
|
|
@ -222,7 +222,23 @@ namespace Introspection {
|
|||
path = null;
|
||||
break;
|
||||
case "libSystem.Native":
|
||||
path += ".dylib";
|
||||
var staticallyLinked = false;
|
||||
#if __MACCATALYST__
|
||||
// always statically linked
|
||||
staticallyLinked = true;
|
||||
#elif __IOS__ || __TVOS__
|
||||
// statically linked on device
|
||||
staticallyLinked = Runtime.Arch == Arch.DEVICE;
|
||||
#elif __MACOS__
|
||||
// never statically linked (by default)
|
||||
#else
|
||||
#error Unknown platform
|
||||
#endif
|
||||
if (staticallyLinked) {
|
||||
path = null;
|
||||
} else {
|
||||
path += ".dylib";
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case "libc":
|
||||
|
|
|
@ -66,5 +66,25 @@ namespace LinkAnyTest {
|
|||
GC.KeepAlive (view.HeightAnchor);
|
||||
}
|
||||
#endif // !__WATCHOS__
|
||||
|
||||
[Test]
|
||||
public void JsonSerializer_Serialize ()
|
||||
{
|
||||
var a = JsonSerializer.Serialize (42);
|
||||
Assert.AreEqual ("42", a, "serialized 42");
|
||||
|
||||
var b = JsonSerializer.Serialize (new int [] { 42, 3, 14, 15 });
|
||||
Assert.AreEqual ("[42,3,14,15]", b, "serialized array");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void JsonSerializer_Deserialize ()
|
||||
{
|
||||
var a = JsonSerializer.Deserialize<int> ("42");
|
||||
Assert.AreEqual (42, a, "deserialized 42");
|
||||
|
||||
var b = JsonSerializer.Deserialize<int[]> ("[42,3,14,15]");
|
||||
CollectionAssert.AreEqual (new int [] { 42, 3, 14, 15 }, b, "deserialized array");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace MonoTouchFixtures.ObjCRuntime {
|
|||
}
|
||||
}
|
||||
|
||||
#if !DEVICE && !MONOMAC && !AOT // some of these tests cause the AOT compiler to assert
|
||||
#if !DEVICE && !MONOMAC && !AOT && !__MACCATALYST__ // some of these tests cause the AOT compiler to assert
|
||||
// No MonoPInvokeCallback
|
||||
static void InvalidTrampoline1 () { }
|
||||
|
||||
|
|
|
@ -207,6 +207,7 @@ namespace Xharness {
|
|||
public bool INCLUDE_XAMARIN_LEGACY { get; }
|
||||
public string SYSTEM_MONO { get; set; }
|
||||
public string DOTNET_DIR { get; set; }
|
||||
public string DotNetTfm { get; set; }
|
||||
|
||||
// Run
|
||||
|
||||
|
@ -284,6 +285,7 @@ namespace Xharness {
|
|||
SYSTEM_MONO = config ["SYSTEM_MONO"];
|
||||
DOTNET_DIR = config ["DOTNET_DIR"];
|
||||
INCLUDE_XAMARIN_LEGACY = config.ContainsKey ("INCLUDE_XAMARIN_LEGACY") && !string.IsNullOrEmpty (config ["INCLUDE_XAMARIN_LEGACY"]);
|
||||
DotNetTfm = config ["DOTNET_TFM"];
|
||||
|
||||
if (string.IsNullOrEmpty (SdkRoot))
|
||||
SdkRoot = config ["XCODE_DEVELOPER_ROOT"] ?? configuration.SdkRoot;
|
||||
|
@ -615,6 +617,7 @@ namespace Xharness {
|
|||
IEnumerable<string> GetConfigFiles ()
|
||||
{
|
||||
return FindConfigFiles (useSystemXamarinIOSMac ? "test-system.config" : "test.config")
|
||||
.Concat (FindConfigFiles ("configure.inc"))
|
||||
.Concat (FindConfigFiles ("Make.config"))
|
||||
.Concat (FindConfigFiles ("Make.config.local"));
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ namespace Xharness {
|
|||
bool UseGroupedApps { get; }
|
||||
string VSDropsUri { get; }
|
||||
bool DisableWatchOSOnWrench { get; }
|
||||
string DotNetTfm { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace Xharness.Targets {
|
|||
|
||||
public const string FSharpGuid = "{F2A71F9B-5D33-465A-A702-920D77279786}";
|
||||
public const string CSharpGuid = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";
|
||||
public const string DotNetTfm = "net8.0";
|
||||
public string DotNetTfm => Harness.DotNetTfm;
|
||||
|
||||
public string LanguageGuid { get { return IsFSharp ? FSharpGuid : CSharpGuid; } }
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ namespace ClassRedirector {
|
|||
const string classPtrName = "class_ptr";
|
||||
CSToObjCMap map;
|
||||
string pathToXamarinAssembly;
|
||||
string? outputDirectory = null;
|
||||
Dictionary<string, FieldDefinition> csTypeToFieldDef = new Dictionary<string, FieldDefinition> ();
|
||||
IEnumerable<AssemblyDefinition> assemblies;
|
||||
AssemblyDefinition xamarinAssembly;
|
||||
|
@ -328,11 +327,6 @@ namespace ClassRedirector {
|
|||
}
|
||||
}
|
||||
|
||||
string ToOutputFileName (string pathToInputFileName)
|
||||
{
|
||||
return Path.Combine (outputDirectory, Path.GetFileName (pathToInputFileName));
|
||||
}
|
||||
|
||||
void MarkForSave (AssemblyDefinition assembly)
|
||||
{
|
||||
var annotations = linkContext.Annotations;
|
||||
|
|
|
@ -3309,6 +3309,12 @@ namespace Registrar {
|
|||
|
||||
bool HasIntPtrBoolCtor (TypeDefinition type, List<Exception> exceptions)
|
||||
{
|
||||
return HasIntPtrBoolCtor (type, exceptions, out var _);
|
||||
}
|
||||
|
||||
bool HasIntPtrBoolCtor (TypeDefinition type, List<Exception> exceptions, [NotNullWhen (true)] out MethodDefinition? ctor)
|
||||
{
|
||||
ctor = null;
|
||||
if (!type.HasMethods)
|
||||
return false;
|
||||
foreach (var method in type.Methods) {
|
||||
|
@ -3330,6 +3336,7 @@ namespace Registrar {
|
|||
if (!method.Parameters [0].ParameterType.Is ("System", "IntPtr"))
|
||||
continue;
|
||||
}
|
||||
ctor = method;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -4528,6 +4535,11 @@ namespace Registrar {
|
|||
}
|
||||
|
||||
public TypeDefinition GetInstantiableType (TypeDefinition td, List<Exception> exceptions, string descriptiveMethodName)
|
||||
{
|
||||
return GetInstantiableType (td, exceptions, descriptiveMethodName, out var _);
|
||||
}
|
||||
|
||||
public TypeDefinition GetInstantiableType (TypeDefinition td, List<Exception> exceptions, string descriptiveMethodName, out MethodDefinition ctor)
|
||||
{
|
||||
TypeDefinition nativeObjType = td;
|
||||
|
||||
|
@ -4540,7 +4552,7 @@ namespace Registrar {
|
|||
}
|
||||
|
||||
// verify that the type has a ctor with two parameters
|
||||
if (!HasIntPtrBoolCtor (nativeObjType, exceptions))
|
||||
if (!HasIntPtrBoolCtor (nativeObjType, exceptions, out ctor))
|
||||
throw ErrorHelper.CreateError (4103, Errors.MT4103, nativeObjType.FullName, descriptiveMethodName);
|
||||
|
||||
return nativeObjType;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>net$(BundledNETCoreAppTargetFrameworkVersion)</TargetFramework>
|
||||
<RootNamespace>create_dotnet_linker_launch_json</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
|
|
@ -49,9 +49,15 @@ for platform in $DISABLED_DOTNET_PLATFORMS; do
|
|||
done
|
||||
|
||||
echo "##vso[task.setvariable variable=INCLUDE_XAMARIN_LEGACY;isOutput=true]$INCLUDE_XAMARIN_LEGACY"
|
||||
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_IOS;isOutput=true]$INCLUDE_IOS"
|
||||
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_TVOS;isOutput=true]$INCLUDE_TVOS"
|
||||
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_WATCH;isOutput=true]$INCLUDE_WATCH"
|
||||
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_MAC;isOutput=true]$INCLUDE_MAC"
|
||||
|
||||
if test -n "$INCLUDE_XAMARIN_LEGACY"; then
|
||||
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_IOS;isOutput=true]$INCLUDE_IOS"
|
||||
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_TVOS;isOutput=true]$INCLUDE_TVOS"
|
||||
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_WATCH;isOutput=true]$INCLUDE_WATCH"
|
||||
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_MAC;isOutput=true]$INCLUDE_MAC"
|
||||
else
|
||||
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_IOS;isOutput=true]"
|
||||
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_TVOS;isOutput=true]"
|
||||
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_WATCH;isOutput=true]"
|
||||
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_MAC;isOutput=true]"
|
||||
fi
|
||||
set -x
|
||||
|
|
|
@ -231,6 +231,12 @@ namespace Xamarin.Linker {
|
|||
}
|
||||
}
|
||||
|
||||
public FieldReference System_IntPtr_Zero {
|
||||
get {
|
||||
return GetFieldReference (CorlibAssembly, System_IntPtr, "Zero", "System.IntPtr::Zero", out var _);
|
||||
}
|
||||
}
|
||||
|
||||
public TypeReference System_Nullable_1 {
|
||||
get {
|
||||
return GetTypeReference (CorlibAssembly, "System.Nullable`1", out var _);
|
||||
|
@ -779,6 +785,16 @@ namespace Xamarin.Linker {
|
|||
}
|
||||
}
|
||||
|
||||
public MethodReference Runtime_TryGetNSObject {
|
||||
get {
|
||||
return GetMethodReference (PlatformAssembly,
|
||||
ObjCRuntime_Runtime, "TryGetNSObject",
|
||||
nameof (Runtime_TryGetNSObject),
|
||||
isStatic: true,
|
||||
System_IntPtr,
|
||||
System_Boolean);
|
||||
}
|
||||
}
|
||||
public MethodReference Runtime_GetNSObject__System_IntPtr {
|
||||
get {
|
||||
return GetMethodReference (PlatformAssembly,
|
||||
|
@ -814,19 +830,6 @@ namespace Xamarin.Linker {
|
|||
}
|
||||
}
|
||||
|
||||
public MethodReference Runtime_GetINativeObject__IntPtr_Boolean_Type_Type {
|
||||
get {
|
||||
return GetMethodReference (PlatformAssembly,
|
||||
ObjCRuntime_Runtime, "GetINativeObject",
|
||||
nameof (Runtime_GetINativeObject__IntPtr_Boolean_Type_Type),
|
||||
isStatic: true,
|
||||
System_IntPtr,
|
||||
System_Boolean,
|
||||
System_Type,
|
||||
System_Type);
|
||||
}
|
||||
}
|
||||
|
||||
public MethodReference Runtime_CreateRuntimeException {
|
||||
get {
|
||||
return GetMethodReference (PlatformAssembly,
|
||||
|
@ -1142,6 +1145,7 @@ namespace Xamarin.Linker {
|
|||
current_assembly = null;
|
||||
type_map.Clear ();
|
||||
method_map.Clear ();
|
||||
field_map.Clear ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -921,14 +921,42 @@ namespace Xamarin.Linker {
|
|||
// cast to the generic type to verify that the item is actually of the correct type
|
||||
il.Emit (OpCodes.Unbox_Any, type);
|
||||
} else {
|
||||
var nativeObjType = StaticRegistrar.GetInstantiableType (type.Resolve (), exceptions, GetMethodSignature (method));
|
||||
StaticRegistrar.GetInstantiableType (type.Resolve (), exceptions, GetMethodSignature (method), out var ctor);
|
||||
EnsureVisible (method, ctor);
|
||||
var targetType = method.Module.ImportReference (type);
|
||||
var handleVariable = il.Body.AddVariable (abr.System_IntPtr);
|
||||
var objectVariable = il.Body.AddVariable (targetType);
|
||||
var loadHandle = il.Create (OpCodes.Ldloc, handleVariable);
|
||||
var loadObjectVariable = il.Create (OpCodes.Ldloc, objectVariable);
|
||||
il.Emit (OpCodes.Stloc, handleVariable);
|
||||
// objectVariable = null
|
||||
il.Emit (OpCodes.Ldnull);
|
||||
il.Emit (OpCodes.Stloc, objectVariable);
|
||||
// if (handle == IntPtr.Zero)
|
||||
// goto done;
|
||||
il.Emit (OpCodes.Ldloc, handleVariable); // handle
|
||||
il.Emit (OpCodes.Ldsfld, abr.System_IntPtr_Zero);
|
||||
il.Emit (OpCodes.Beq, loadObjectVariable);
|
||||
// objectVariable = TryGetNSObject (handle, false) as TargetType
|
||||
il.Emit (OpCodes.Ldloc, handleVariable); // handle
|
||||
il.Emit (OpCodes.Ldc_I4_0); // false
|
||||
il.Emit (OpCodes.Ldtoken, method.Module.ImportReference (type)); // target type
|
||||
il.Emit (OpCodes.Call, abr.Type_GetTypeFromHandle);
|
||||
il.Emit (OpCodes.Ldtoken, method.Module.ImportReference (nativeObjType)); // implementation type
|
||||
il.Emit (OpCodes.Call, abr.Type_GetTypeFromHandle);
|
||||
il.Emit (OpCodes.Call, abr.Runtime_GetINativeObject__IntPtr_Boolean_Type_Type);
|
||||
il.Emit (OpCodes.Castclass, type);
|
||||
il.Emit (OpCodes.Call, abr.Runtime_TryGetNSObject);
|
||||
il.Emit (OpCodes.Castclass, targetType);
|
||||
il.Emit (OpCodes.Stloc, objectVariable);
|
||||
// if (objectVariable is null)
|
||||
// objectVariable = new TargetType (handle, false)
|
||||
il.Emit (OpCodes.Ldloc, objectVariable);
|
||||
il.Emit (OpCodes.Brfalse, loadHandle);
|
||||
il.Emit (OpCodes.Br, loadObjectVariable);
|
||||
il.Append (loadHandle);
|
||||
if (ctor.Parameters [0].ParameterType.Is ("ObjCRuntime", "NativeHandle"))
|
||||
il.Emit (OpCodes.Call, abr.NativeObject_op_Implicit_NativeHandle);
|
||||
il.Emit (OpCodes.Ldc_I4_0); // false
|
||||
il.Emit (OpCodes.Newobj, method.Module.ImportReference (ctor));
|
||||
il.Emit (OpCodes.Stloc, objectVariable);
|
||||
// done:
|
||||
// (load objectVariable on the stack)
|
||||
il.Append (loadObjectVariable);
|
||||
}
|
||||
nativeType = abr.System_IntPtr;
|
||||
} else {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFramework>net$(BundledNETCoreAppTargetFrameworkVersion)</TargetFramework>
|
||||
<RootNamespace>dotnet_linker</RootNamespace>
|
||||
<DefineConstants>$(DefineConstants);BUNDLER</DefineConstants>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<WarningsAsErrors>nullable</WarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="..\..\eng\Versions.props" />
|
||||
|
|
|
@ -189,6 +189,9 @@ namespace Xamarin.Linker.Steps {
|
|||
Where (v => v.EndsWith (".dylib", StringComparison.OrdinalIgnoreCase) || v.EndsWith (".a", StringComparison.OrdinalIgnoreCase)).
|
||||
Select (v => Path.GetFileNameWithoutExtension (v)).
|
||||
Select (v => v.StartsWith ("lib", StringComparison.OrdinalIgnoreCase) ? v.Substring (3) : v).ToHashSet ();
|
||||
#if !__MACOS__
|
||||
monoLibraryVariations.Add ("System.Globalization.Native"); // System.Private.CoreLib has P/Invokes pointing to libSystem.Globalization.Native, but they're actually in libmonosgen-2.0
|
||||
#endif
|
||||
monoLibraryVariations.UnionWith (monoLibraryVariations.Select (v => "lib" + v).ToArray ());
|
||||
monoLibraryVariations.UnionWith (monoLibraryVariations.Select (v => v + ".dylib").ToArray ());
|
||||
// If the P/Invoke points to any of those libraries, then we add it as a P/Invoke symbol.
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.0" />
|
||||
<PackageReference Include="MSBuild.StructuredLogger" Version="2.1.758" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -21,6 +22,7 @@
|
|||
<Compile Include="../../common/ApplePlatform.cs" Link="ApplePlatform.cs" />
|
||||
|
||||
<Compile Include="../../../tests/mtouch/Cache.cs" Link="Cache.cs" />
|
||||
<Compile Include="../../../tests/common/BinLog.cs" Link="BinLog.cs" />
|
||||
<Compile Include="../../../tests/common/Configuration.cs" Link="Configuration.cs" />
|
||||
<Compile Include="../../../tests/common/Profile.cs" Link="Profile.cs" />
|
||||
<Compile Include="../../../tests/common/ExecutionHelper.cs" Link="ExecutionHelper.cs" />
|
||||
|
|
Загрузка…
Ссылка в новой задаче