From 92cd0740972188b857681410dae7b2617b6100e5 Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Mon, 25 Jan 2021 08:19:31 +0100 Subject: [PATCH] Created Xamarin - Could not load file or assembly (markdown) --- Xamarin---Could-not-load-file-or-assembly.md | 36 ++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Xamarin---Could-not-load-file-or-assembly.md diff --git a/Xamarin---Could-not-load-file-or-assembly.md b/Xamarin---Could-not-load-file-or-assembly.md new file mode 100644 index 0000000..2af6f8a --- /dev/null +++ b/Xamarin---Could-not-load-file-or-assembly.md @@ -0,0 +1,36 @@ +When using WireMock.Net in a Xamarin test project, you can encounter these errors: + +## Could not load file or assembly 'System.Memory, Version=4.0.1.0 +``` +WireMock.Exceptions.WireMockException : Service start failed with error: One or more errors occurred. (Could not load type of field 'Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportOptions:k__BackingField' (1) due to: Could not load file or assembly 'System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.) + ----> System.AggregateException : One or more errors occurred. (Could not load type of field 'Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportOptions:k__BackingField' (1) due to: Could not load file or assembly 'System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.) + ----> System.TypeLoadException : Could not load type of field 'Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportOptions:k__BackingField' (1) due to: Could not load file or assembly 'System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. +TearDown : System.NullReferenceException : Object reference not set to an instance of an object +``` + +or + +### Solution: + +Adding assembly binding redirects to the app.config for the assemblies which have an error. +Like: +``` xml + + + + + + + + + + + + + + + + + + +``` \ No newline at end of file