Skip to content

Commit

Permalink
Disable assembly preload by default
Browse files Browse the repository at this point in the history
Disable the current default behavior of Xamarin.Android runtime to
preload all the assemblies shipped in the apk on application startup.
This behavior has been the default in order to support older versions of
`Xamarin.Forms`, sacrificing startup performance.
  • Loading branch information
grendello committed Mar 30, 2021
1 parent 0cad538 commit 7fce2dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3932,7 +3932,11 @@ public void PackageNamingPolicy ([Values ("LowercaseMD5", "LowercaseCrc64")] str
Assert.IsTrue (b.Build (proj), "build should have succeeded.");
var environment = b.Output.GetIntermediaryPath (Path.Combine ("__environment__.txt"));
FileAssert.Exists (environment);
Assert.AreEqual ($"__XA_PACKAGE_NAMING_POLICY__={packageNamingPolicy}", File.ReadAllText (environment).Trim ());
if (Builder.UseDotNet) {
Assert.AreEqual ($"__XA_PACKAGE_NAMING_POLICY__={packageNamingPolicy}{Environment.NewLine}mono.enable_assembly_preload=0", File.ReadAllText (environment).Trim ());
} else {
Assert.AreEqual ($"__XA_PACKAGE_NAMING_POLICY__={packageNamingPolicy}", File.ReadAllText (environment).Trim ());
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
<AndroidMakeBundleKeepTemporaryFiles Condition=" '$(AndroidMakeBundleKeepTemporaryFiles)' == '' ">False</AndroidMakeBundleKeepTemporaryFiles>

<!-- If true it will cause all the assemblies in the apk to be preloaded on startup time -->
<_AndroidEnablePreloadAssembliesDefault>True</_AndroidEnablePreloadAssembliesDefault>
<_AndroidEnablePreloadAssembliesDefault Condition=" '$(UsingAndroidNETSdk)' == 'true' ">False</_AndroidEnablePreloadAssembliesDefault>
<_AndroidEnablePreloadAssembliesDefault Condition=" '$(UsingAndroidNETSdk)' != 'true' ">True</_AndroidEnablePreloadAssembliesDefault>
<AndroidEnablePreloadAssemblies Condition=" '$(AndroidEnablePreloadAssemblies)' == '' ">$(_AndroidEnablePreloadAssembliesDefault)</AndroidEnablePreloadAssemblies>
<_NativeAssemblySourceDir>$(IntermediateOutputPath)android\</_NativeAssemblySourceDir>
<_AndroidUseNewTypemaps>True</_AndroidUseNewTypemaps>
Expand Down

0 comments on commit 7fce2dd

Please sign in to comment.