Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin UI Tests Error: Type 'MonoDevelop.MonoDroid.DeploymentException' is not marked as serializable

I'm currently getting the following error and stacktrace when attempting to run UI Tests locally against my Xamarin.Android project. This error doesn't occur on every run, but its pretty frequent. A clean and rebuild will usually "fix" it, but when trying to run all tests is the suite this is a really annoying error.

I'm not really sure where to proceed from here. Any direction on where to look for debugging this error, or if anyone know what causes the error, would be greatly appreciated.

System/Framework info:

  • NUnit: 2.6.4
  • Xamarin.UITests Version: 2.2.4
  • Android Target Framwork: 8.0
  • Visual Studio Professional 2017 for Mac Version 7.5 (build 1254)
  • Mono 5.10.1.47 (2017-12/8eb8f7d5e74) (64-bit)
  • Xamarin.Android: Version: 8.3.0.19 (Visual Studio Professional)

SetUp : System.Runtime.Serialization.SerializationException : Type 'MonoDevelop.MonoDroid.DeploymentException' in Assembly 'MonoDevelop.MonoDroid, Version=4.0.0.24, Culture=neutral, PublicKeyToken=3ead7498f347467b' is not marked as serializable.

Server stack trace: 
  at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize (System.Object obj, System.Runtime.Serialization.ISurrogateSelector surrogateSelector, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.Formatters.Binary.SerObjectInfoInit serObjectInfoInit, System.Runtime.Serialization.IFormatterConverter converter, System.Runtime.Serialization.Formatters.Binary.ObjectWriter objectWriter, System.Runtime.Serialization.SerializationBinder binder) [0x00175] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryobjectinfo.cs:171 
  at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize (System.Object obj, System.Runtime.Serialization.ISurrogateSelector surrogateSelector, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.Formatters.Binary.SerObjectInfoInit serObjectInfoInit, System.Runtime.Serialization.IFormatterConverter converter, System.Runtime.Serialization.Formatters.Binary.ObjectWriter objectWriter, System.Runtime.Serialization.SerializationBinder binder) [0x00006] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryobjectinfo.cs:110 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write (System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo objectInfo, System.Runtime.Serialization.Formatters.Binary.NameInfo memberNameInfo, System.Runtime.Serialization.Formatters.Binary.NameInfo typeNameInfo) [0x00101] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryobjectwriter.cs:422 
  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize (System.Object graph, System.Runtime.Remoting.Messaging.Header[] inHeaders, System.Runtime.Serialization.Formatters.Binary.__BinaryWriter serWriter, System.Boolean fCheck) [0x001d3] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryobjectwriter.cs:190 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (System.IO.Stream serializationStream, System.Object graph, System.Runtime.Remoting.Messaging.Header[] headers, System.Boolean fCheck) [0x0006e] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryformatter.cs:233 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (System.IO.Stream serializationStream, System.Object graph, System.Runtime.Remoting.Messaging.Header[] headers) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryformatter.cs:211 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (System.IO.Stream serializationStream, System.Object graph) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/serialization/formatters/binary/binaryformatter.cs:203 
  at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage (System.Runtime.Remoting.Channels.IServerChannelSinkStack sinkStack, System.Runtime.Remoting.Messaging.IMessage requestMsg, System.Runtime.Remoting.Channels.ITransportHeaders requestHeaders, System.IO.Stream requestStream, System.Runtime.Remoting.Messaging.IMessage& responseMsg, System.Runtime.Remoting.Channels.ITransportHeaders& responseHeaders, System.IO.Stream& responseStream) [0x00125] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/BinaryServerFormatterSink.cs:182 

Exception rethrown at [0]: 
  at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_remoting_wrapper(intptr,intptr)
  at (wrapper remoting-invoke) Xamarin.UITest.Utils.Integration.IIdeHost.PrepareTestApp(string)
  at Xamarin.UITest.Utils.Integration.IdeConnection.PrepareTestApp () [0x00037] in <1bd397951f434cd4913ddc08b7bc45af>:0 
  at Xamarin.UITest.Utils.Integration.IdeIntegrationClient.TryConnect (Xamarin.UITest.Platform platform) [0x00064] in <1bd397951f434cd4913ddc08b7bc45af>:0 
  at Xamarin.UITest.Android.AndroidApp..ctor (Xamarin.UITest.Configuration.IAndroidAppConfiguration appConfiguration, Xamarin.UITest.Shared.Execution.IExecutor executor) [0x000ad] in <1bd397951f434cd4913ddc08b7bc45af>:0 
  at Xamarin.UITest.Android.AndroidApp..ctor (Xamarin.UITest.Configuration.IAndroidAppConfiguration appConfiguration) [0x00000] in <1bd397951f434cd4913ddc08b7bc45af>:0 
  at Xamarin.UITest.Configuration.AndroidAppConfigurator.StartApp (Xamarin.UITest.Configuration.AppDataMode appDataMode) [0x00017] in <1bd397951f434cd4913ddc08b7bc45af>:0 
  at Dalevia.UITests.AppInitializer.StartApp (Xamarin.UITest.Platform platform, Xamarin.UITest.Configuration.AppDataMode dataMode) [0x00010] in /Users/dfrisk/Source/Compass/Compass-Patient/src/src/Mobile/RedArrow.Compass.Patients.Mobile.UI.Tests/AppInitializer.cs:28 
  at Dalevia.UITests.AppInitializer.StartApp (Xamarin.UITest.Platform platform) [0x00001] in /Users/dfrisk/Source/Compass/Compass-Patient/src/src/Mobile/RedArrow.Compass.Patients.Mobile.UI.Tests/AppInitializer.cs:14 
  at Dalevia.UITests.BaseTests.BeforeEachTest () [0x00001] in /Users/dfrisk/Source/Compass/Compass-Patient/src/src/Mobile/RedArrow.Compass.Patients.Mobile.UI.Tests/Tests/BaseTests.cs:42 
  at Dalevia.UITests.Tests.CaseStatusTests.BeforeEachTest () [0x00001] in /Users/dfrisk/Source/Compass/Compass-Patient/src/src/Mobile/RedArrow.Compass.Patients.Mobile.UI.Tests/Tests/CaseStatusTests.cs:26 
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.Reflection/MonoMethod.cs:305 
like image 949
drewfrisk Avatar asked May 15 '18 15:05

drewfrisk


1 Answers

I also ran into this, and what worked for me was uninstalling the app on the device, then reinstalling with a fresh copy. Notably, I was connecting to a device that hadn't been used in a while, so it was several versions older than my current application.

like image 175
klreeher Avatar answered Oct 31 '22 08:10

klreeher