Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 33 additions & 7 deletions tests/dotnet/UnitTests/AppSizeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Xamarin.Tests {
[TestFixture]
[Ignore ("The results depend on the macOS version of the bot running the test")]
public class AppSizeTest : TestBaseClass {
Comment on lines 10 to 11

[TestCase (ApplePlatform.iOS, "ios-arm64")]
Expand Down Expand Up @@ -121,14 +120,41 @@ void Run (ApplePlatform platform, string runtimeIdentifiers, string configuratio
var update = forceUpdate || !string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("WRITE_KNOWN_FAILURES"));
var expectedDirectory = Path.Combine (Configuration.SourceRoot, "tests", "dotnet", "UnitTests", "expected");

Assert.Multiple (() => {
AssertAppSize (platform, name, appPath, update, forceUpdate, expectedDirectory);
try {
Assert.Multiple (() => {
AssertAppSize (platform, name, appPath, update, forceUpdate, expectedDirectory);

if (supportsAssemblyInspection)
AssertAssemblyReport (platform, name, appPath, update, expectedDirectory);
if (supportsAssemblyInspection)
AssertAssemblyReport (platform, name, appPath, update, expectedDirectory);

AssertExpectedDSyms (platform, appPath);
});
AssertExpectedDSyms (platform, appPath);
});
} catch {
// If the test fails on CI, copy the resulting .app bundle to a location that will be uploaded as an
// Azure DevOps artifact (zipped). This is for diagnostic purposes only.
CopyAppBundleForDiagnostics (name, appPath);
throw;
}
}

static void CopyAppBundleForDiagnostics (string name, string appPath)
{
var artifactStagingDir = Environment.GetEnvironmentVariable ("BUILD_ARTIFACTSTAGINGDIRECTORY");
if (string.IsNullOrEmpty (artifactStagingDir))
return; // not running in Azure DevOps CI

try {
var outputDir = Path.Combine (artifactStagingDir, "failed-app-size-bundles");
Directory.CreateDirectory (outputDir);
// Use a sortable timestamp to make the zip file name unique, so subsequent failing tests don't overwrite it.
var timestamp = DateTime.UtcNow.ToString ("yyyyMMdd'T'HHmmss'Z'");
var zipPath = Path.Combine (outputDir, $"{name}-{Path.GetFileName (appPath)}-{timestamp}.zip");
Console.WriteLine ($" Zipping app bundle '{appPath}' to '{zipPath}' for diagnostics...");
System.IO.Compression.ZipFile.CreateFromDirectory (appPath, zipPath, System.IO.Compression.CompressionLevel.Optimal, includeBaseDirectory: true);
Console.WriteLine ($" Zipped app bundle to '{zipPath}'.");
} catch (Exception e) {
Console.WriteLine ($" Failed to zip app bundle for diagnostics: {e}");
}
}

static void AssertAppSize (ApplePlatform platform, string name, string appPath, bool update, bool forceUpdate, string expectedDirectory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Microsoft.MacCatalyst.dll:AppKit.ActionDispatcher.get_WorksWhenModal()
Microsoft.MacCatalyst.dll:AppKit.ActionDispatcher.OnActivated(Foundation.NSObject)
Microsoft.MacCatalyst.dll:AppKit.ActionDispatcher.OnActivated2(Foundation.NSObject)
Microsoft.MacCatalyst.dll:AppKit.ActionDispatcher/__Registrar_Callbacks__
Microsoft.MacCatalyst.dll:AppKit.ActionDispatcher/__Registrar_Callbacks__.callback_3136_AppKit_ActionDispatcher_OnActivated(System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr*)
Microsoft.MacCatalyst.dll:AppKit.ActionDispatcher/__Registrar_Callbacks__.callback_3137_AppKit_ActionDispatcher_OnActivated2(System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr*)
Microsoft.MacCatalyst.dll:AppKit.ActionDispatcher/__Registrar_Callbacks__.callback_3139_AppKit_ActionDispatcher_get_WorksWhenModal(System.IntPtr, System.IntPtr, System.IntPtr*)
Microsoft.MacCatalyst.dll:AppKit.ActionDispatcher/__Registrar_Callbacks__.callback_3134_AppKit_ActionDispatcher_OnActivated(System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr*)
Microsoft.MacCatalyst.dll:AppKit.ActionDispatcher/__Registrar_Callbacks__.callback_3135_AppKit_ActionDispatcher_OnActivated2(System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr*)
Microsoft.MacCatalyst.dll:AppKit.ActionDispatcher/__Registrar_Callbacks__.callback_3137_AppKit_ActionDispatcher_get_WorksWhenModal(System.IntPtr, System.IntPtr, System.IntPtr*)
Microsoft.MacCatalyst.dll:CoreFoundation.CFArray
Microsoft.MacCatalyst.dll:CoreFoundation.CFArray._Xamarin_ConstructINativeObject(ObjCRuntime.NativeHandle, System.Boolean)
Microsoft.MacCatalyst.dll:CoreFoundation.CFArray..cctor()
Expand Down Expand Up @@ -188,8 +188,8 @@ Microsoft.MacCatalyst.dll:Foundation.NSObject/NSObject_Disposer.Add(Foundation.N
Microsoft.MacCatalyst.dll:Foundation.NSObject/NSObject_Disposer.Drain(Foundation.NSObject)
Microsoft.MacCatalyst.dll:Foundation.NSObject/NSObject_Disposer.ScheduleDrain()
Microsoft.MacCatalyst.dll:Foundation.NSObject/NSObject_Disposer/__Registrar_Callbacks__
Microsoft.MacCatalyst.dll:Foundation.NSObject/NSObject_Disposer/__Registrar_Callbacks__.callback_3055_Foundation_NSObject_NSObject_Disposer__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*)
Microsoft.MacCatalyst.dll:Foundation.NSObject/NSObject_Disposer/__Registrar_Callbacks__.callback_3056_Foundation_NSObject_NSObject_Disposer_Drain(System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr*)
Microsoft.MacCatalyst.dll:Foundation.NSObject/NSObject_Disposer/__Registrar_Callbacks__.callback_3053_Foundation_NSObject_NSObject_Disposer__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*)
Microsoft.MacCatalyst.dll:Foundation.NSObject/NSObject_Disposer/__Registrar_Callbacks__.callback_3054_Foundation_NSObject_NSObject_Disposer_Drain(System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr*)
Microsoft.MacCatalyst.dll:Foundation.NSObject/XamarinGCHandleFlags
Microsoft.MacCatalyst.dll:Foundation.NSObject/XamarinGCHandleFlags Foundation.NSObject/XamarinGCHandleFlags::HasManagedRef
Microsoft.MacCatalyst.dll:Foundation.NSObject/XamarinGCHandleFlags Foundation.NSObject/XamarinGCHandleFlags::InitialSet
Expand Down Expand Up @@ -975,7 +975,6 @@ Microsoft.MacCatalyst.dll:Registrar.Registrar.CreateExceptionImpl(System.Int32,
Microsoft.MacCatalyst.dll:Registrar.Registrar.CreateExceptionImpl(System.Int32, System.Boolean, System.String, System.Object[])
Microsoft.MacCatalyst.dll:Registrar.Registrar.CreateExceptionImpl(System.Int32, System.Boolean, System.Type, System.String, System.Object[])
Microsoft.MacCatalyst.dll:Registrar.Registrar.CreateSetterSelector(System.String)
Microsoft.MacCatalyst.dll:Registrar.Registrar.CreateWarning(System.Int32, Registrar.Registrar/ObjCMember, System.String, System.Object[])
Microsoft.MacCatalyst.dll:Registrar.Registrar.FindMethods(System.Type, System.String)
Microsoft.MacCatalyst.dll:Registrar.Registrar.FindProperty(System.Type, System.String)
Microsoft.MacCatalyst.dll:Registrar.Registrar.FindType(System.Type, System.String, System.String)
Expand Down Expand Up @@ -1071,6 +1070,7 @@ Microsoft.MacCatalyst.dll:Registrar.Registrar.RegisterType(System.Type, System.C
Microsoft.MacCatalyst.dll:Registrar.Registrar.RegisterType(System.Type)
Microsoft.MacCatalyst.dll:Registrar.Registrar.RegisterTypeUnsafe(System.Type, System.Collections.Generic.List`1<System.Exception>&)
Microsoft.MacCatalyst.dll:Registrar.Registrar.ReportError(System.Int32, System.String, System.Object[])
Microsoft.MacCatalyst.dll:Registrar.Registrar.ReportWarning(System.Int32, System.String, System.Object[])
Microsoft.MacCatalyst.dll:Registrar.Registrar.SanitizeObjectiveCName(System.String)
Microsoft.MacCatalyst.dll:Registrar.Registrar.SkipRegisterAssembly(System.Reflection.Assembly)
Microsoft.MacCatalyst.dll:Registrar.Registrar.ToSignature(System.Type, Registrar.Registrar/ObjCMember, System.Boolean)
Expand Down Expand Up @@ -1611,7 +1611,7 @@ Microsoft.MacCatalyst.dll:UIKit.UIApplicationDelegate..ctor(ObjCRuntime.NativeHa
Microsoft.MacCatalyst.dll:UIKit.UIApplicationDelegate..ctor(System.IntPtr, ObjCRuntime.IManagedRegistrar)
Microsoft.MacCatalyst.dll:UIKit.UIApplicationDelegate.FinishedLaunching(UIKit.UIApplication, Foundation.NSDictionary)
Microsoft.MacCatalyst.dll:UIKit.UIApplicationDelegate/__Registrar_Callbacks__
Microsoft.MacCatalyst.dll:UIKit.UIApplicationDelegate/__Registrar_Callbacks__.callback_568_UIKit_UIApplicationDelegate__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*)
Microsoft.MacCatalyst.dll:UIKit.UIApplicationDelegate/__Registrar_Callbacks__.callback_566_UIKit_UIApplicationDelegate__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*)
Microsoft.MacCatalyst.dll:UIKit.UIButton
Microsoft.MacCatalyst.dll:UIKit.UIButton._Xamarin_ConstructINativeObject(ObjCRuntime.NativeHandle, System.Boolean)
Microsoft.MacCatalyst.dll:UIKit.UIButton._Xamarin_ConstructNSObject(ObjCRuntime.NativeHandle)
Expand Down Expand Up @@ -1797,6 +1797,8 @@ System.Private.CoreLib.dll:<PrivateImplementationDetails>/__StaticArrayInitTypeS
System.Private.CoreLib.dll:<PrivateImplementationDetails>/__StaticArrayInitTypeSize=696_Align=8 <PrivateImplementationDetails>::02BF302F66F50150BCF5E322DA879E92E417084D14FBE4F5345DDCB68F863E518
System.Private.CoreLib.dll:<PrivateImplementationDetails>/__StaticArrayInitTypeSize=76_Align=4
System.Private.CoreLib.dll:<PrivateImplementationDetails>/__StaticArrayInitTypeSize=76_Align=4 <PrivateImplementationDetails>::25308BAB47481701F1E861B1EA4F2409E73ABB14E9579C26DF4ABE440A0DCF0A4
System.Private.CoreLib.dll:<PrivateImplementationDetails>/__StaticArrayInitTypeSize=8_Align=2
System.Private.CoreLib.dll:<PrivateImplementationDetails>/__StaticArrayInitTypeSize=8_Align=2 <PrivateImplementationDetails>::8BFD94DEAAC0F168DC8B50A00AC120A113B550B68FEF344F807D503D1A6E5DED2
System.Private.CoreLib.dll:<PrivateImplementationDetails>/__StaticArrayInitTypeSize=88_Align=8
System.Private.CoreLib.dll:<PrivateImplementationDetails>/__StaticArrayInitTypeSize=88_Align=8 <PrivateImplementationDetails>::40EC13C575237954625B718CA2B291A90543D086FE5E3258F158FDDD3A9067CC8
System.Private.CoreLib.dll:<PrivateImplementationDetails>/__StaticArrayInitTypeSize=936_Align=4
Expand Down Expand Up @@ -4161,6 +4163,7 @@ System.Private.CoreLib.dll:System.Diagnostics.CodeAnalysis.DynamicDependencyAttr
System.Private.CoreLib.dll:System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute..ctor(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, System.Type)
System.Private.CoreLib.dll:System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute..ctor(System.String, System.String, System.String)
System.Private.CoreLib.dll:System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute..ctor(System.String, System.Type)
System.Private.CoreLib.dll:System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute..ctor(System.String)
System.Private.CoreLib.dll:System.Diagnostics.CodeAnalysis.MaybeNullAttribute
System.Private.CoreLib.dll:System.Diagnostics.CodeAnalysis.MaybeNullAttribute..ctor()
System.Private.CoreLib.dll:System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute
Expand Down Expand Up @@ -7064,8 +7067,7 @@ System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEntry.ToSpecifiedFull
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEntry/FileNameBuffer
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEntry/FileNameBuffer System.IO.Enumeration.FileSystemEntry::_fileNameBuffer
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerable`1
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerable`1..ctor(System.String, System.IO.Enumeration.FileSystemEnumerable`1/FindTransform<TResult>, System.IO.EnumerationOptions, System.Boolean)
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerable`1..ctor(System.String, System.IO.Enumeration.FileSystemEnumerable`1/FindTransform<TResult>, System.IO.EnumerationOptions)
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerable`1..ctor(System.String, System.IO.Enumeration.FileSystemEnumerable`1/FindTransform<TResult>, System.IO.EnumerationOptions, System.Boolean, System.String)
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerable`1.get_ShouldIncludePredicate()
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerable`1.get_ShouldRecursePredicate()
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerable`1.GetEnumerator()
Expand Down Expand Up @@ -7114,8 +7116,9 @@ System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerableFactory/<>c
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerableFactory/<>c.<UserEntries>b__4_0(System.IO.Enumeration.FileSystemEntry&)
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerableFactory/<>c.<UserFiles>b__2_0(System.IO.Enumeration.FileSystemEntry&)
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerator`1
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerator`1..ctor(System.String, System.Boolean, System.IO.EnumerationOptions, System.String)
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerator`1..ctor(System.String, System.Boolean, System.IO.EnumerationOptions)
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerator`1.<MoveNext>g__ShouldSkip|35_0(System.IO.FileAttributes)
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerator`1.<MoveNext>g__ShouldSkip|36_0(System.IO.FileAttributes)
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerator`1.CloseDirectoryHandle()
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerator`1.ContinueOnError(System.Int32)
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(System.String, System.Boolean)
Expand All @@ -7137,6 +7140,7 @@ System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerator`1.ShouldIn
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerator`1.ShouldRecurseIntoEntry(System.IO.Enumeration.FileSystemEntry&)
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemEnumerator`1.TransformEntry(System.IO.Enumeration.FileSystemEntry&)
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemName
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemName.EscapeExpression(System.String)
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemName.MatchesSimpleExpression(System.ReadOnlySpan`1<System.Char>, System.ReadOnlySpan`1<System.Char>, System.Boolean)
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemName.MatchesWin32Expression(System.ReadOnlySpan`1<System.Char>, System.ReadOnlySpan`1<System.Char>, System.Boolean)
System.Private.CoreLib.dll:System.IO.Enumeration.FileSystemName.MatchPattern(System.ReadOnlySpan`1<System.Char>, System.ReadOnlySpan`1<System.Char>, System.Boolean, System.Boolean)
Expand Down Expand Up @@ -12430,6 +12434,7 @@ System.Private.CoreLib.dll:System.String System.Int16::System.IBinaryIntegerPars
System.Private.CoreLib.dll:System.String System.Int32::System.IBinaryIntegerParseAndFormatInfo<System.Int32>.OverflowMessage()
System.Private.CoreLib.dll:System.String System.Int64::System.IBinaryIntegerParseAndFormatInfo<System.Int64>.OverflowMessage()
System.Private.CoreLib.dll:System.String System.IO.Enumeration.FileSystemEnumerable`1::_directory
System.Private.CoreLib.dll:System.String System.IO.Enumeration.FileSystemEnumerable`1::_expression
System.Private.CoreLib.dll:System.String System.IO.Enumeration.FileSystemEnumerableFactory/<>c__DisplayClass2_0::expression
System.Private.CoreLib.dll:System.String System.IO.Enumeration.FileSystemEnumerableFactory/<>c__DisplayClass3_0::expression
System.Private.CoreLib.dll:System.String System.IO.Enumeration.FileSystemEnumerableFactory/<>c__DisplayClass4_0::expression
Expand Down Expand Up @@ -12714,8 +12719,6 @@ System.Private.CoreLib.dll:System.String.op_Equality(System.String, System.Strin
System.Private.CoreLib.dll:System.String.op_Implicit(System.String) => System.ReadOnlySpan`1<System.Char>
System.Private.CoreLib.dll:System.String.op_Inequality(System.String, System.String)
System.Private.CoreLib.dll:System.String.Replace(System.Char, System.Char)
System.Private.CoreLib.dll:System.String.Replace(System.String, System.String)
System.Private.CoreLib.dll:System.String.ReplaceHelper(System.Int32, System.String, System.ReadOnlySpan`1<System.Int32>)
System.Private.CoreLib.dll:System.String.Split(System.Char, System.StringSplitOptions)
System.Private.CoreLib.dll:System.String.Split(System.String, System.StringSplitOptions)
System.Private.CoreLib.dll:System.String.SplitInternal(System.ReadOnlySpan`1<System.Char>, System.Int32, System.StringSplitOptions)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
AppBundleSize: 5,789,578 bytes (5,653.9 KB = 5.5 MB)
AppBundleSize: 5,788,759 bytes (5,653.1 KB = 5.5 MB)
# The following list of files and their sizes is just informational / for review, and isn't used in the test:
Contents/_CodeSignature/CodeResources: 3,310 bytes (3.2 KB = 0.0 MB)
Contents/Info.plist: 1,119 bytes (1.1 KB = 0.0 MB)
Contents/MacOS/SizeTestApp: 4,565,424 bytes (4,458.4 KB = 4.4 MB)
Contents/Info.plist: 1,100 bytes (1.1 KB = 0.0 MB)
Contents/MacOS/SizeTestApp: 4,565,120 bytes (4,458.1 KB = 4.4 MB)
Contents/MonoBundle/Microsoft.MacCatalyst.dll: 157,696 bytes (154.0 KB = 0.2 MB)
Contents/MonoBundle/runtimeconfig.bin: 1,405 bytes (1.4 KB = 0.0 MB)
Contents/MonoBundle/SizeTestApp.dll: 7,680 bytes (7.5 KB = 0.0 MB)
Contents/MonoBundle/System.Private.CoreLib.aotdata.arm64: 41,224 bytes (40.3 KB = 0.0 MB)
Contents/MonoBundle/System.Private.CoreLib.dll: 998,400 bytes (975.0 KB = 1.0 MB)
Contents/MonoBundle/System.Private.CoreLib.aotdata.arm64: 41,240 bytes (40.3 KB = 0.0 MB)
Contents/MonoBundle/System.Private.CoreLib.dll: 997,888 bytes (974.5 KB = 1.0 MB)
Contents/MonoBundle/System.Runtime.dll: 5,120 bytes (5.0 KB = 0.0 MB)
Contents/MonoBundle/System.Runtime.InteropServices.dll: 8,192 bytes (8.0 KB = 0.0 MB)
Contents/PkgInfo: 8 bytes (0.0 KB = 0.0 MB)
Loading