Exemplo n.º 1
0
        public void Runtime_RegisterEntryAssembly()
        {
#if NET
            TestRuntime.AssertSimulator("https://github.com/xamarin/xamarin-macios/issues/10457");
#endif

            var klass = Type.GetType("ObjCRuntime.Runtime, " + AssemblyName);
            Assert.NotNull(klass, "Runtime");
            // RegisterEntryAssembly is only needed for the simulator (not on devices) so it's only preserved for sim builds
            var method = klass.GetMethod("RegisterEntryAssembly", BindingFlags.NonPublic | BindingFlags.Static, null, new [] { typeof(Assembly) }, null);
#if __MACOS__
            var expectedNull = true;
#else
            var expectedNull = TestRuntime.IsDevice;
#endif
            Assert.That(method == null, Is.EqualTo(expectedNull), "RegisterEntryAssembly");
        }
Exemplo n.º 2
0
        public void Simlauncher()
        {
            TestRuntime.AssertSimulator("Only needed on simulator");

            var all = GetFrameworks();

            var namespaces = new HashSet <string> (StringComparer.OrdinalIgnoreCase);

            foreach (Type t in Assembly.GetTypes())
            {
                if (!t.IsPublic)
                {
                    continue;
                }
                namespaces.Add(t.Namespace);
            }

            foreach (var line in File.ReadAllLines("simlauncher64-sgen.frameworks"))
            {
                var c = line.IndexOf(" (compatibility");
                if (c < 0)
                {
                    continue;
                }
                var path = line.Substring(1, c - 1);
                if (!path.StartsWith("/System/Library/Frameworks/", StringComparison.Ordinal))
                {
                    continue;
                }
                var fx = Path.GetFileNameWithoutExtension(path);

                // match with mtouch framework list
                if (!all.TryGetValue(fx, out var framework))
                {
                    // special cases
                    switch (fx)
                    {
                    case "CoreAudio":                  // AudioToolbox, AVFoundation...
                    case "CoreFoundation":             // implied (always linked)
                    case "CFNetwork":                  // implied (StartWWAN) and included (mostly) in CoreServices
                    case "OpenAL":                     // part of OpenTK
                        break;

                    case "CoreMIDI":
                        // CoreMidi (case) in the fx list
                        break;

                    default:
                        ReportError($"{fx} is not part of mtouch's GetFrameworks");
                        break;
                    }
                }

                // match with Xamarin.iOS.dll namespaces
                if (!namespaces.Contains(fx))
                {
                    // special cases
                    switch (fx)
                    {
                    case "CoreAudio":                  // AudioToolbox, AVFoundation...
                    case "CFNetwork":                  // implied (StartWWAN) and included (mostly) in CoreServices
                    case "OpenAL":                     // part of OpenTK
                        break;

                    default:
                        ReportError($"{fx} is not part of mtouch's GetFrameworks");
                        break;
                    }
                }
            }

            AssertIfErrors($"{Errors} unknown frameworks found:\n{ErrorData}");
        }