Xamarin Android MvvmCross Linking issues - visual-studio

I am building my first release version of Xamarin Android with MvvmCross. Just like most other people who have similar issue, the app run ok in debug mode but not release with linking. I have been stuck and searched for days but still could not resolve it. Please kindly help.
I have the latest Visual Studio 2017 v15.7.2, .net 4.7.03056, Xamarin 4.10.0.48 & Android SDK 8.1 installed.
To resolve the issue, I start running in Debug mode with linking “Sdk Assemblies Only” and not using Shared Runtime. The following errors occur:
05-24 02:21:52.490 D/Mono( 9114) : Assembly Loader probing location: '/usr/local/lib/mono/gac/System.Runtime/4.0.0.0__b03f5f7f11d50a3a/System.Runtime.dll'.
05-24 02:21:52.490 D/Mono( 9114) : Assembly Loader probing location: '/usr/local/lib/System.Runtime.dll'.
05-24 02:21:52.490 D/Mono( 9114) : Assembly Loader probing location: '/usr/local/lib/mono/gac/System.Runtime/4.0.0.0__b03f5f7f11d50a3a/System.Runtime.exe'.
05-24 02:21:52.491 D/Mono( 9114) : Assembly Loader probing location: '/usr/local/lib/System.Runtime.exe'.
05-24 02:21:52.491 D/Mono( 9114) : Assembly Loader probing location: '/usr/local/lib/mono/gac/System.Runtime/4.0.0.0__b03f5f7f11d50a3a/System.Runtime.dll'.
05-24 02:21:52.491 D/Mono( 9114) : Assembly Loader probing location: '/storage/emulated/0/Android/data/.../files/.__override__/System.Runtime.dll'.
05-24 02:21:52.491 D/Mono( 9114) : Assembly Loader probing location: '/usr/local/lib/System.Runtime.dll'.
05-24 02:21:52.491 D/Mono( 9114) : Assembly Loader probing location: '/usr/local/lib/mono/gac/System.Runtime/4.0.0.0__b03f5f7f11d50a3a/System.Runtime.exe'.
05-24 02:21:52.491 D/Mono( 9114) : Assembly Loader probing location: '/storage/emulated/0/Android/data/xxx.Droid/files/.__override__/System.Runtime.exe'.
05-24 02:21:52.493 D/Mono( 9114) : Assembly Loader probing location: '/usr/local/lib/System.Runtime.exe'.
05-24 02:21:52.493 W/Mono( 9114) : The following assembly referenced from /storage/emulated/0/Android/data/xxx.Droid/files/.__override__/MvvmCross.Platform.dll could not be loaded:
05-24 02:21:52.493 W/Mono( 9114) : Assembly: System.Runtime(assemblyref_index=0)
05-24 02:21:52.493 W/Mono( 9114) : Version: 4.0.0.0
05-24 02:21:52.493 W/Mono( 9114) : Public Key: b03f5f7f11d50a3a
05-24 02:21:52.493 W/Mono( 9114) : The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly(/storage/emulated/0/Android/data/xxx.Droid/files/.__override__/).
05-24 02:21:52.493 D/Mono( 9114) : Failed to load assembly MvvmCross.Platform[0xe7ec5ea0].
05-24 02:21:52.493 W/ ( 9114): Could not load signature of MvvmCross.Platform.Droid.Views.MvxEventSourceActivity:add_CreateWillBeCalled due to: Could not load file or assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.assembly:System.Runtime, Version= 4.0.0.0, Culture= neutral, PublicKeyToken= b03f5f7f11d50a3a type:<unknown type> member:(null) signature:<none>
Unhandled Exception:
System.TypeLoadException: Could not resolve the signature of a virtual method
05-24 02:24:36.309 D/Mono( 9114) : Assembly Ref addref xxx.Droid[0xe7ec5240] -> MvvmCross.Plugins.ResxLocalization[0xe7ec6260]: 2
05-24 02:24:36.310 D/Mono ( 9114): Assembly Loader probing location: '/usr/local/lib/mono/gac/System.Runtime/4.0.0.0__b03f5f7f11d50a3a/System.Runtime.dll'.
05-24 02:24:36.310 D/Mono( 9114) : Assembly Loader probing location: '/usr/local/lib/System.Runtime.dll'.
05-24 02:24:36.310 D/Mono( 9114) : Assembly Loader probing location: '/usr/local/lib/mono/gac/System.Runtime/4.0.0.0__b03f5f7f11d50a3a/System.Runtime.exe'.
05-24 02:24:36.310 D/Mono( 9114) : Assembly Loader probing location: '/usr/local/lib/System.Runtime.exe'.
05-24 02:24:36.311 D/Mono( 9114) : Assembly Loader probing location: '/usr/local/lib/mono/gac/System.Runtime/4.0.0.0__b03f5f7f11d50a3a/System.Runtime.dll'.
05-24 02:24:36.311 D/Mono( 9114) : Assembly Loader probing location: '/storage/emulated/0/Android/data/xxx.Droid/files/.__override__/System.Runtime.dll'.
It seems that it is trying to locate an older version of System.Runtime. I added bindingRedirect to the app.conig. No luck with it: Removing all dependentAssembly does not help too. My System.Runtime version is 4.3.0
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.2.0" newVersion="1.2.2.0" />
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
When running in Release mode with “Sdk Assemblies Only”, I got the following message in log (sorry for not able to copy it as text but screen shot only):
This looks more like related to linking. I have the standard LinkerPleaseInclude with all property & method that were bound in my xml specified. However, the app crash at the splash screen before reaching my own code. This is the code of my splashscreen, just the untouched one clone from the sample.
namespace xxx.Droid
{
[Activity(
Label = "xxx.Droid"
, MainLauncher = true
, Icon = "#drawable/icon"
, Theme = "#style/Theme.Splash"
, NoHistory = true
, ScreenOrientation = ScreenOrientation.Portrait)]
public class SplashScreen : MvxSplashScreenActivity
{
public SplashScreen()
: base(Resource.Layout.splash_screen)
{
}
}
}
In summary,
I have 3 questions right now:
BindingRedirect in debug mode does not work. Cannot run with linking in debug mode made problem solving much harder
In release mode, crash at splash screen. However, I cannot see what is missing from the log
Is there any rule / hint from log to find out what should be included in the linkerpleaseinclude?
Thank you very much for any help
Nick

Related

MQ client 8.0.0.4 type initializer error when called from ssis script task

While migrating from mq dot client 1.0 to mq 8.0.0.4, receiving following error when call mq manager is made.
call is made from a script task from ssis 2012 package. call to mq manager works when called from a windows service.
Inner Exception :
System.IO.FileLoadException: Could not load file or assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0x80070542)
File name: 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ---> System.IO.FileLoadException: Could not load file or assembly 'System.Web`enter code here`, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0x80070542)
File name: 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
=== Pre-bind state information ===
LOG: DisplayName = System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///C:/Program Files/Microsoft SQL Server/110/DTS/Binn/
LOG: Initial PrivatePath = NULL
Calling assembly : amqmdnet, Version=9.0.0.3, Culture=neutral, PublicKeyToken=dd3cb1c9aae9ec97.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files\Microsoft SQL Server\110\DTS\Binn\DTExec.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Version redirect found in framework config: 2.0.0.0 redirected to 4.0.0.0.
LOG: Post-policy reference: System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
at IBM.WMQ.CommonServices.GetPropertyValue(String propertyName, Boolean tryEnvironment)
at IBM.WMQ.CommonServices.CreateCommonServices()
at IBM.WMQ.CommonServices.TraceConstructor(String objectId, String sccsid)
at IBM.WMQ.Nmqi.NmqiEnvironment..ctor(NmqiPropertyHandler nmqiPropertyHandler)
at IBM.WMQ.Nmqi.NmqiFactory.GetInstance(NmqiPropertyHandler properties)
at IBM.WMQ.MQQueueManager..cctor()
Stack Trace :
at IBM.WMQ.MQQueueManager..ctor(String queueManagerName, Hashtable properties)
at CIBC.CTS.PMI.MQ.MQConnection.Connect(String hostName, Int32 port, String queueManagerName, String channelName, String replyQueueManagerName, String mqIdentity)
Message :
The type initializer for 'IBM.WMQ.MQQueueManager' threw an exception.
Source :
amqmdnet
Edit: have tried installing version 9.0.0.3 too as 8.0.0.4 had know issue with unmanaged code calling mq, but that did not work.
could this issue be due to version redirector as per the binding log?
LOG: Version redirect found in framework config: 2.0.0.0 redirected to 4.0.0.0.
Or related to Impersonation from SSIS script task? Impersonaltion level is shown as "Identification"

How to Disable AOT in Xamarin IOS when deploy to iPhone

My solution consists of 3 projects:
My backend project with assembly My_Test_App (portable)
My_Test_App.Android
My_Test_App.iOS
I develop using VS2015 and use mac to build and deploy. It works fine in iOS simulator. My iOS project do not use linker. Also i have LLVM and incremental build already unchecked.
But when i tried to debug to iPhone device, i got this error:
Severity Code Description Project File Line Suppression State
Error Could not AOT the assembly/Users/myMacName/Library/Caches/Xamarin/mtbs/builds/My_Test_App.iOS/c7eaf4168fcb1f8aaecd3a6cbb0f37ee/obj/iPhone/Release/mtouch-cache/64/Build/My_Test_App.dll' My_Test_App.iOS
My question is:
How do you disable the AOT in the Xamarin.iOS project? When i check the csproj file of the iOS project, it does not have like in the droid project.
Is disabling the AOT the correct way to solve it?
Thank you for answering!
My build log:
1>------ Build started: Project: My_Test_App.Droid, Configuration: Debug Any CPU ------
2>------ Build started: Project: My_Test_App.iOS, Configuration: Debug iPhone ------
1> Consider app.config remapping of assembly "System.Runtime, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.0.0" [] to Version "4.1.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Runtime.dll] to solve conflict and get rid of warning.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding>
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.
1> My_Test_App.Droid -> D:\Project\2017\Xamarin Test\test-mobile\My Test App\My_Test_App.Droid\bin\Debug\My_Test_App.Droid.dll
2> Generated session id: c7eaf4168fcb1f8aaecd3a6cbb0f37ee
2> Generated build app name: My_Test_App.iOS
2> Connecting to Mac server MTMAC22s-Mac-mini.local...
2> No way to resolve conflict between "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
2> Consider app.config remapping of assembly "System.Numerics, Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version "2.0.5.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Xamarin.iOS\v1.0\System.Numerics.dll] to Version "4.0.0.0" [C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll] to solve conflict and get rid of warning.
2> Consider app.config remapping of assembly "System.Net.Http, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "1.5.0.0" [] to Version "4.0.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Xamarin.iOS\v1.0\System.Net.Http.dll] to solve conflict and get rid of warning.
2>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190.
2>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.
2>D:\Project\2017\Xamarin Test\test-mobile\My Test App\My_Test_App.iOS\Renderers\CustomLabelRenderer.cs(143,53,143,69): warning CS0618: 'Label.Font' is obsolete: 'Please use the Font attributes which are on the class itself. Obsoleted in v1.3.0'
2> My_Test_App.iOS -> D:\Project\2017\Xamarin Test\test-mobile\My Test App\My_Test_App.iOS\bin\iPhone\Debug\My_Test_AppiOS.exe
2> Detected signing identity:
2> Code Signing Key: "iPhone Developer: myemail#mycompany.com (HDZY35YSCS)" (6E0C54049FD692EBF4A54BBD72889DC336388268)
2> Provisioning Profile: "iOS Team Provisioning Profile: com.yourcompany.MyTestApp" (8f408fd0-90e0-4031-92e8-a6a56530778a)
2> Bundle Id: com.yourcompany.MyTestApp
2> App Id: F8AZP5FC9H.com.yourcompany.MyTestApp
2> Mono Ahead of Time compiler - compiling assembly /Users/mtmac22/Library/Caches/Xamarin/mtbs/builds/My_Test_App.iOS/c7eaf4168fcb1f8aaecd3a6cbb0f37ee/obj/iPhone/Debug/mtouch-cache/64/Build/System.Net.Primitives.dll
2> AOTID BE85C9F7-62C4-0559-D329-FA98D6ECDAF2
2> Code: 0(0%) Info: 0(0%) Ex Info: 0(0%) Unwind Info: 0(0%) Class Info: 7(2%) PLT: 1(0%) GOT Info: 236(71%) Offsets: 86(26%) GOT: 120
2> Compiled: 0/0 (100%), No GOT slots: 0 (100%), Direct calls: 0 (100%)
2> Output file: '/Users/mtmac22/Library/Caches/Xamarin/mtbs/builds/My_Test_App.iOS/c7eaf4168fcb1f8aaecd3a6cbb0f37ee/obj/iPhone/Debug/mtouch-cache/System.Net.Primitives.dll.arm64.s'.
2> Linking symbol: '_mono_aot_module_System_Net_Primitives_info'.
2> JIT time: 0 ms, Generation time: 0 ms, Assembly+Link time: 0 ms.
2> /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/external/mono/eglib/src/ghashtable.c:549: assertion 'hash != NULL' failed
2> Mono Ahead of Time compiler - compiling assembly /Users/mtmac22/Library/Caches/Xamarin/mtbs/builds/My_Test_App.iOS/c7eaf4168fcb1f8aaecd3a6cbb0f37ee/obj/iPhone/Debug/mtouch-cache/64/Build/System.Xml.ReaderWriter.dll
2> AOTID 77D080C4-2116-2E71-9BA1-0FB994D16E87
2> Code: 0(0%) Info: 0(0%) Ex Info: 0(0%) Unwind Info: 0(0%) Class Info: 7(2%) PLT: 1(0%) GOT Info: 236(71%) Offsets: 86(26%) GOT: 120
2> Compiled: 0/0 (100%), No GOT slots: 0 (100%), Direct calls: 0 (100%)
2> Output file: '/Users/mtmac22/Library/Caches/Xamarin/mtbs/builds/My_Test_App.iOS/c7eaf4168fcb1f8aaecd3a6cbb0f37ee/obj/iPhone/Debug/mtouch-cache/System.Xml.ReaderWriter.dll.arm64.s'.
2> Linking symbol: '_mono_aot_module_System_Xml_ReaderWriter_info'.
2> JIT time: 0 ms, Generation time: 0 ms, Assembly+Link time: 0 ms.
2> /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/external/mono/eglib/src/ghashtable.c:549: assertion 'hash != NULL' failed
2> Mono Ahead of Time compiler - compiling assembly /Users/mtmac22/Library/Caches/Xamarin/mtbs/builds/My_Test_App.iOS/c7eaf4168fcb1f8aaecd3a6cbb0f37ee/obj/iPhone/Debug/mtouch-cache/64/Build/My_Test_AppiOS.exe
2> AOTID 298562A7-A350-2A44-1D0B-2E4FC728F9D1
2> Code: 54748(65%) Info: 456(0%) Ex Info: 19951(23%) Unwind Info: 1136(1%) Class Info: 4700(5%) PLT: 190(0%) GOT Info: 2018(2%) Offsets: 626(0%) GOT: 2872
2> Compiled: 97/97 (100%), No GOT slots: 0 (0%), Direct calls: 15 (37%)
2> Output file: '/Users/mtmac22/Library/Caches/Xamarin/mtbs/builds/My_Test_App.iOS/c7eaf4168fcb1f8aaecd3a6cbb0f37ee/obj/iPhone/Debug/mtouch-cache/My_Test_AppiOS.exe.arm64.s'.
2> Linking symbol: '_mono_aot_module_My_Test_AppiOS_info'.
2> JIT time: 21 ms, Generation time: 25 ms, Assembly+Link time: 0 ms.
2> AOT Compilation exited with code 139, command:
2> MONO_PATH=/Users/mtmac22/Library/Caches/Xamarin/mtbs/builds/My_Test_App.iOS/c7eaf4168fcb1f8aaecd3a6cbb0f37ee/obj/iPhone/Debug/mtouch-cache/64/Build /Library/Frameworks/Xamarin.iOS.framework/Versions/10.3.1.8/bin/arm64-darwin-mono-sgen --debug -O=gsharedvt --aot=mtriple=arm64-ios,data-outfile=/Users/mtmac22/Library/Caches/Xamarin/mtbs/builds/My_Test_App.iOS/c7eaf4168fcb1f8aaecd3a6cbb0f37ee/obj/iPhone/Debug/mtouch-cache/My_Test_App.arm64.aotdata,static,asmonly,direct-icalls,full,soft-debug,dwarfdebug,no-direct-calls,outfile=/Users/mtmac22/Library/Caches/Xamarin/mtbs/builds/My_Test_App.iOS/c7eaf4168fcb1f8aaecd3a6cbb0f37ee/obj/iPhone/Debug/mtouch-cache/My_Test_App.dll.arm64.s "/Users/mtmac22/Library/Caches/Xamarin/mtbs/builds/My_Test_App.iOS/c7eaf4168fcb1f8aaecd3a6cbb0f37ee/obj/iPhone/Debug/mtouch-cache/64/Build/My_Test_App.dll"
2>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(696,3): error : Could not AOT the assembly '/Users/mtmac22/Library/Caches/Xamarin/mtbs/builds/My_Test_App.iOS/c7eaf4168fcb1f8aaecd3a6cbb0f37ee/obj/iPhone/Debug/mtouch-cache/64/Build/My_Test_App.dll'
2> at Xamarin.Bundler.AOTTask.Build () [0x00117] in <e61e7c7e12a34f76bb60aae297cbc79c>:0
2> at Xamarin.Bundler.BuildTask.Execute () [0x00000] in <e61e7c7e12a34f76bb60aae297cbc79c>:0
2> at Xamarin.Bundler.BuildTasks.Execute (Xamarin.Bundler.BuildTask v) [0x00000] in <e61e7c7e12a34f76bb60aae297cbc79c>:0
2> at System.Threading.Tasks.Parallel+<ForEachWorker>c__AnonStorey6`2[TSource,TLocal].<>m__0 (System.Int32 i) [0x00012] in <8f2c484307284b51944a1a13a14c0266>:0
2> at System.Threading.Tasks.Parallel+<ForWorker>c__AnonStorey3`1[TLocal].<>m__1 () [0x000ed] in <8f2c484307284b51944a1a13a14c0266>:0
========== Build: 1 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
You cannot disable AOT on iOS, your project won't work as iDevices do not allow JIT'ing
No unfortunately no.
We'd need a longer build log (add '-v -v -v' as 'mtouch' arguments), but it can happen because the assembly is too big. you might want to enable Linking All Assemblies in the iOS project settings.
See this for additional references: https://forums.xamarin.com/discussion/457/error-could-not-aot-the-assembly-servicestack-text-monotouch-dll

Missing assemblies after migrating Silverlight 4 application to visual studio 2013 Silverlight 5

We are migrating a Silverlight4 application developed in visual studio 2010 with active directory single sign on to Silverlight 5 for visual studio 2013.
After replacing some .dll's like toolkit and data visualization toolkit and other dll without changing the framework(4.0) it was working fine but When I am changing the active directory project framework from 3.5 to 4.0 or higher it is throwing the following errors:
Error 71 The type name 'RoleProvider' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.
Error 73 The type name 'MembershipUser' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.
Error 74 The type name 'MembershipUser' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.
Error 75 The type name 'MembershipUser' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.
Error 76 The type name 'MembershipUser' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.
Error 78 The type name 'MembershipUser' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.
Error 77 The type name 'MembershipCreateStatus' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.
Error 72 The type 'System.Web.Security.MembershipProvider' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
I tried replacing the assemblies and namespaces but no luck. Does anyone came across this kind of issues. I would appreciate your help if you could give me a solution. thank you very much
remove the existing reference to System.Web.ApplicationServices.dll and refer System.Web.ApplicationServices with version 4.0.0.0.. or higher
You can find it in a folder that might look like C:\Windows\Microsoft.NET\Framework64\v4.0.30319

get invalid exception

System.InvalidOperationException was unhandled
Message=An error occurred creating the form. See Exception.InnerException for details. The error is: Could not load file or assembly 'Interop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source=kn diary
StackTrace:
at kn_diary.My.MyProject.MyForms.Create_Instance_[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
at kn_diary.My.MyProject.MyForms.get_Form1()
at kn_diary.My.MyApplication.OnCreateMainForm() in C:\Users\Pak\Desktop\project\kn diary\kn diary\My Project\Application.Designer.vb:line 35
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at kn_diary.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.BadImageFormatException
Message=Could not load file or assembly 'Interop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source=AxInterop.WMPLib
FileName=Interop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
FusionLog==== Pre-bind state information ===
LOG: User = Pak-PC\Pak
LOG: DisplayName = Interop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Users/Pak/Desktop/project/kn diary/kn diary/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : AxInterop.WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Pak\Desktop\project\kn diary\kn diary\bin\Debug\kn diary.vshost.exe.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/Pak/Desktop/project/kn diary/kn diary/bin/Debug/Interop.WMPLib.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
StackTrace:
at AxWMPLib.AxWindowsMediaPlayer.AttachInterfaces()
at System.Windows.Forms.AxHost.GetOcxCreate()
at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
at System.Windows.Forms.AxHost.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.AxHost.EndInit()
at kn_diary.Form1.InitializeComponent() in C:\Users\Pak\Desktop\project\kn diary\kn diary\Form1.designer.vb:line 91
at kn_diary.Form1..ctor()
InnerException:
This is an indication of failure to load one of the reference assemblies in the chain of references, in this case, an indirect reference. I normally check the fusion log to find out exactly what assembly is failing to load and often why.
Can you check the fusion log and paste the log here in case if you do not already spot the culprit there? You can lunch logger by running "fuslogvw.exe" from VS command prompt. (this link has more detail on how to use the fusion log viewer: http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.80).aspx)

Assembly Binding Old Reference Exception

I have been trying to solve an assembly binding issue for the last 12 hours, with not much luck. Last week, I had upgraded all of the projects in a solution from EF 4.1.0.0 to EF 4.3.1.0. I added some tests this morning to an existing test project, cleaned and recompiled the solution. All the projects compile with no warnings or errors. At my entity framework call anywhere in the project, I receive the following exception:
Initialization method
NutricityPPCTests.Common.DizzleProductExtensionsTests.TestSetup threw
exception. System.IO.FileLoadException: System.IO.FileLoadException:
Could not load file or assembly 'EntityFramework, Version=4.1.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040).
I fired up the fusion assembly binding log viewer, and found the log entry that corresponds to the exception. I have verified that my test project, the MOMData project both are referencing the correct EF4.3.1.0 assembly. I verified there were no references to EF 4.1.0.0 in the project files. I deleted the contents of the obj and bin directories in both projects. The project has been cleaned and rebuilt so many times, that my hard drive is probably going to give out tomorrow.
*** Assembly Binder Log Entry (3/22/2012 # 5:55:11 PM) ***
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\QTAgent32.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = NUTRICITY0\awolske
LOG: DisplayName = EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
(Fully-specified)
LOG: Appbase = file:///C:/Users/awolske/Documents/NutricityWorkspace/Nutricity/NutricityPPCTests/bin/Release
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = QTAgent32.exe
Calling assembly : MomData, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\awolske\Documents\NutricityWorkspace\Nutricity\NutricityPPCTests\bin\Release\NutricityPPCTests.DLL.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Users/awolske/Documents/NutricityWorkspace/Nutricity/NutricityPPCTests/bin/Release/EntityFramework.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Users\awolske\Documents\NutricityWorkspace\Nutricity\NutricityPPCTests\bin\Release\EntityFramework.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: The assembly reference did not match the assembly definition found.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Where else should I be looking for the old referenced assembly?!? Any help would be welcome, and greatly appreciated! Thanks in advance for your time!
Add the following to your web.config file:
<runtime>
<assemblyBinding>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
I had the same error. Most of the projects in my solution where referencing the Entity Framework 4.3.0.0 dll, but when I checked the references for all the projects in my solution, I found some projects referencing the Entity Framework 4.1.0.0 dll. Removing and replacing them with new references to the Entity Framework 4.3.0.0 dll fixed the problem.

Resources