symbol-collector icon indicating copy to clipboard operation
symbol-collector copied to clipboard

UI Tests fail when run locally

Open jamescrosswell opened this issue 10 months ago • 4 comments

Possibly blocked by:

  • https://github.com/getsentry/sentry-dotnet/issues/3761

Xamarin.UITest doesn't work with an app built with .NET 9

1) Error : SymbolCollector.Android.UITests.Tests.CollectSymbols
System.Exception : No .NET assemblies were found in the application. Please disable Fast Deployment in the Visual Studio project property pages or edit the project file in a text editor and set the 'EmbedAssembliesIntoApk' MSBuild property to 'true'.
  at Xamarin.UITest.Shared.Android.ApkFile.EnsureDotNetAssembliesAreBundled () [0x00008] in <b9b62bebca2b4a9e85e5edd581b4def3>:0 
  at Xamarin.UITest.Android.AndroidAppInitializer.PrepareApkFiles (Xamarin.UITest.Configuration.IAndroidAppConfiguration appConfiguration, Xamarin.UITest.Shared.Artifacts.ArtifactFolder artifactFolder) [0x0016a] in <c9af78a12b8d433882fce1ed49df24c2>:0 
  at Xamarin.UITest.Android.AndroidApp..ctor (Xamarin.UITest.Configuration.IAndroidAppConfiguration appConfiguration, Xamarin.UITest.Shared.Execution.IExecutor executor) [0x00143] in <c9af78a12b8d433882fce1ed49df24c2>:0 
  at Xamarin.UITest.Android.AndroidApp..ctor (Xamarin.UITest.Configuration.IAndroidAppConfiguration appConfiguration) [0x00000] in <c9af78a12b8d433882fce1ed49df24c2>:0 
  at Xamarin.UITest.Configuration.AndroidAppConfigurator.StartApp (Xamarin.UITest.Configuration.AppDataMode appDataMode) [0x00017] in <c9af78a12b8d433882fce1ed49df24c2>:0 
  at SymbolCollector.Android.UITests.Tests.BeforeEachTest () [0x0002f] in <2ba557932dfd4d2f9f65d4a8e949dfd1>:0 
  at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <e068e2227ab74c1bb3d724ebaab0e3ff>:0 

But EmbedAssembliesIntoApk didn't help.

Originally posted by @bruno-garcia in https://github.com/getsentry/symbol-collector/issues/203#issuecomment-2480894591

jamescrosswell avatar Jan 14 '25 00:01 jamescrosswell

We are experiencing this as well.

matt-architect avatar Mar 03 '25 19:03 matt-architect

.net-8.0 apk contains a folder called "assemblies" which contain the .NET assemblies

.net-9.0 apk does not contain this folder. Instead it appears the .NET assemblies have been moved into the lib folder under the name(s) libassemblies.{ARCH}-v8a.blob.so

Xamarin.UITest is probably looking in the wrong place for net9.0

matt-architect avatar Mar 03 '25 19:03 matt-architect

@mattallscripts any work arounds you found?

bruno-garcia avatar Mar 05 '25 02:03 bruno-garcia

Microsoft Support has indicated that this is not supported.

The only option we have is the run UI Tests on a .NET 8 version of the code and in the meantime get our tests converted to SpecFlow to support .NET 9

Have you @bruno-garcia found any other option in the meantime?

matt-architect avatar Apr 04 '25 19:04 matt-architect

I nuked the old UITests, at first went with Android Instrumentation, working on Emulators.

  • https://github.com/getsentry/symbol-collector/pull/220

But at the end went to Appium, since saucelabs doens't support Instrumentation with a single apk (and having 2 apks didn't really work during my tests due to mono runtime crashes)

  • https://github.com/getsentry/symbol-collector/pull/221

bruno-garcia avatar Jun 01 '25 04:06 bruno-garcia