I have seen a previous SO Question here that discusses a similar (identical?) issue, but there was no answer there that could satisfy my problem.
My Environment:
MonoDevelop 3.0.3.2
Installation UUID: ????????
Runtime:
Mono 2.10.9 (tarball)
GTK 2.24.10
GTK# (2.12.0.0)
Package version: 210090011
Mono for Android not installed
Apple Developer Tools:
Xcode 4.3.3 (1178)
Build 4E3002
Monotouch: 5.2.12
Build information:
Release ID: 30003002
Git revision: 7bf6ac0ca43c1b12703176ad9933c3484c05c84c-dirty
Build date: 2012-06-16 04:36:10+0000
Xamarin addins: 62ad7268d38c2ece7e00dc32960bd3bdab8fec38
Operating System:
Mac OS X 10.7.4
Darwin NEWTON.local 11.4.0 Darwin Kernel Version 11.4.0
Mon Apr 9 19:32:15 PDT 2012
root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64
My Code (Ping & PingResponse are DTOs in my own ServiceModel library):
Ping request = new Ping { LoginInfo = new IMDSSWebService_SS.ServiceModel.ClientLoginInfo { UserName="guest", Password="guest", ClientPlatform="iOS", ClientVersion="1.5", InstanceUID="uid1"} };
var response = _appDel.ServiceClient.Send<IMDSSWebService_SS.ServiceModel.PingResponse>(request);
ServiceStack Libraries:
ServiceStack.Common.Monotouch.dll (built from git src)
ServiceStack.Interfaces.Monotouch.dll (built from git src)
ServiceStack.Text.Monotouch (built from git src)
Exception:
System.ExecutionEngineException has been thrown
Attempting to JIT compile method 'ServiceStack.Text.Json.JsonReader`1:GetParseFn ()' while running with --aot-only.
System.ExecutionEngineException: Attempting to JIT compile method 'ServiceStack.Text.Json.JsonReader`1:GetParseFn ()' while running with --aot-only.
at ServiceStack.Text.Json.JsonReader.GetParseFn (System.Type type) [0x00000] in :0
at ServiceStack.Text.Json.JsonTypeSerializer.GetParseFn (System.Type type) [0x00000] in :0
at ServiceStack.Text.Common.TypeAccessor.Create (ITypeSerializer serializer, ServiceStack.Text.TypeConfig typeConfig, System.Reflection.PropertyInfo propertyInfo) [0x00000] in :0
at ServiceStack.Text.Common.DeserializeType`1[ServiceStack.Text.Json.JsonTypeSerializer].GetParseMethod (ServiceStack.Text.TypeConfig typeConfig) [0x00000] in :0
at ServiceStack.Text.Common.JsReader`1[ServiceStack.Text.Json.JsonTypeSerializer].GetParseFn[PingResponse] () [0x00000] in :0
at ServiceStack.Text.Json.JsonReader`1[IMDSSWebService_SS.ServiceModel.PingResponse]..cctor () [0x00000] in :0
I did try calling JsConfig.RegisterForAot(), but that didn't change anything. I also tried various permutations of Link SDK Only, Link All, Link None, but all failed either with the above exception, or didn't build at all, see below.
Simulator/Debug - Works Fine
Simulator/Release - Works Fine
iPhone/Debug - Exception Above
iPhone/Release - Doesn't even build. (will create a separate SO question)
I added a Type Registration function to ServiceStack.Text.Monotouch.JsConfig.cs that lets you register your custom DTOs for AOT compilation. There is a pull request to the ServiceStack mainline, so this should make it in soon.
JsConfig Code Change
You need to register all of your Response DTO Types that aren't standard C# types (string, int, etc.). My PingResponse DTO includes a StatusEnum Enumeration, so I have to register both before I can Parse a response without throwing a JIT Exception. Using the patch above, I would call the following in my Monotouch App:
JsConfig.RegisterForAot();
JsConfig.RegisterTypeForAot<PingResponse>();
JsConfig.RegisterTypeForAot<StatusEnum>();
This could get really messy for Complicated DTOs. Hopefully someone (maybe I will if time permits) can come up with an automated way of discovering all types in your DTO that should be registered? Maybe reflection?
Related
After adding NLog to our Xamarin forms app with support for the Azure Blob Storage, the Android Release builds fail with the following:
Error Mono.Linker.MarkException: Error processing method: 'System.Void Microsoft.Azure.Services.AppAuthentication.AdalAuthenticationContext/<AcquireTokenAsync>d__3::MoveNext()' in assembly: 'Microsoft.Azure.Services.AppAuthentication.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Threading.Tasks.Task`1<Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult> Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContextIntegratedAuthExtensions::AcquireTokenAsync(Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext,System.String,System.String,Microsoft.IdentityModel.Clients.ActiveDirectory.UserCredential)
at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
--- End of inner exception stack trace ---
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.LinkAssemblies.RunTask()
at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/builder/azdo/_work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 17 iliidit.Android
I've traced it down to the package NLog.Extensions.AzureBlobStorage and see that this package has Microsoft.Azure.Services.AppAuthentication as a dependency (which is in the error message!).
I've found: https://stackoverflow.com/a/69050534/11269239 which is sort of similar, but a different binary. Have tried to setup the linker file, but can't seem to work it out...
Reading this: https://learn.microsoft.com/en-us/xamarin/cross-platform/deploy-test/linker
I have tried many combinations, but think this the most precise.
<linker>
<assembly fullname="Microsoft.IdentityModel.Clients.ActiveDirectory">
<type fullname="AuthenticationContextIntegratedAuthExtensions">
<method name="AcquireTokenAsync" />
</type>
</assembly>
</linker>
And set the Build Action to LinkDescription.
I've also tried wildcards.... not sure what I'm doing wrong :(
New updated NLog.Extensions.AzureBlobStorage ver 4.0 has now been released, that switches from legacy AzureServiceTokenProvider to the new Azure.Identity:
https://www.nuget.org/packages/NLog.Extensions.AzureBlobStorage
Hope it will resolve the build issues on the Android-platform
I am trying to run a Xamarin test application on a fresh install of Ubuntu 20.04.2
On a windows 10 machine, I am cloning this repo:
https://github.com/jsuarezruiz/xamarin-forms-gtk-movies-sample
Compile it in Visual Studio 2019, it runs perfectly on android and windows GTK
Then I copy the contents of bin/Debug folder to my Linux machine and try running it with mono, it throws an exception:
Unhandled Exception:
System.DllNotFoundException: libglib-2.0-0.dll assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) GLib.Marshaller.g_utf16_to_utf8(char*,intptr,intptr,intptr,intptr&)
at GLib.Marshaller.StringToPtrGStrdup (System.String str) [0x00034] in <d973ca9f8b494b789fba7fe0ad040b14>:0
at GLib.Global.set_ProgramName (System.String value) [0x00001] in <d973ca9f8b494b789fba7fe0ad040b14>:0
at Gtk.Application.SetPrgname () [0x0000d] in <35293b6aa2744433b0e2f41f34e699d5>:0
at Gtk.Application.Init () [0x00001] in <35293b6aa2744433b0e2f41f34e699d5>:0
at Movies.GTK.Program.Main (System.String[] args) [0x00043] in <87211febe55c459f869a2b0842e037c3>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: libglib-2.0-0.dll assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) GLib.Marshaller.g_utf16_to_utf8(char*,intptr,intptr,intptr,intptr&)
at GLib.Marshaller.StringToPtrGStrdup (System.String str) [0x00034] in <d973ca9f8b494b789fba7fe0ad040b14>:0
at GLib.Global.set_ProgramName (System.String value) [0x00001] in <d973ca9f8b494b789fba7fe0ad040b14>:0
at Gtk.Application.SetPrgname () [0x0000d] in <35293b6aa2744433b0e2f41f34e699d5>:0
at Gtk.Application.Init () [0x00001] in <35293b6aa2744433b0e2f41f34e699d5>:0
at Movies.GTK.Program.Main (System.String[] args) [0x00043] in <87211febe55c459f869a2b0842e037c3>:0
Obviously missing a "libglib-2.0-0.dll", which I am not sure how to install on Linux and where mono searches for it.
So far I tried installing mono-devel, mono-complete, gtk-sharp2, libglib2.0-dev
After searching through mono logs I noticed that it's trying to access windows-specific dlls, so I tried setting library reference parameter "Copy Local" to false on these libraries:
atk-sharp
gdk-sharp
glade-sharp
glib-sharp
gtk-dotnet
gtk-sharp
pango-sharp
And it worked on ubuntu 18.04.3 LTS
I am trying to build a xamarin component.
I have a created a SomeLibrary.dll from a Binding project.
Using this SomeLibrary.dll and the Component Template(https://components.xamarin.com/guidelines
), I have generated a SomeLibrary-1.0.xam component.
I executed this command to install the SomeLibrary component onto Xamarin Studio(so I can test the component before submitting it to the store):
mono xamarin-component.exe install /Users/somedeveloper/Desktop/XamarinComponent/component-template-master/SomeLibrary-1.0.xam
(recommended by http://forums.xamarin.com/discussion/5640/test-component-packaging)
Now, I am trying to test my SomeLibrary component. I created a brand new project, added the component to my project, wrote a couple of lines that uses SomeLibrary api, and got the following error as I build and run.
I am lost and confused here, any idea, suggestions would be great.^^.
The main thing that I see from the error is:
error MT2002: Failed to resolve assembly: 'SomeLibrary, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
It seems to be complaining about some sort of PublicKeyToken. What is this? Do I have to generate a PublicKeyToken for my SomeLibrary component? If so, how do I generate a PublicKeyToken.
thanks and appreciate any help, suggestion, or comments !^_^!,
Full Error Log
Building: SomeLibraryComponent (Debug|iPhone)
Detecting signing identity...
Provisioning Profile: XXXXXXXXXXXXXXXXXXXXXXXXXXXX
Signing Identity: "iPhone Developer: XXXXXXXXXX (ALKJLKJSLDKJFLJ)"
App ID: "SDLFJLKSDJF.SomeLibrarycomponent"
Performing main compilation...
/Library/Frameworks/Mono.framework/Versions/3.2.3/bin/mcs /noconfig "/r:/Developer/MonoTouch/usr/lib/mono/2.1/mscorlib.dll" -nostdlib "/out:/Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/bin/iPhone/Debug/SomeLibraryComponent.exe" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" "/r:/Users/somedeveloper/projects/SomeLibraryComponent/Components/SomeLibrary-1.0/lib/ios/SomeLibrary.iOS.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" /nologo /warn:4 /debug:full /optimize- /codepage:utf8 "/define:DEBUG;__MOBILE__;__IOS__" /t:exe "/Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/Main.cs" "/Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/AppDelegate.cs" "/Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/SomeLibraryComponentViewController.cs" "/Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/SomeLibraryComponentViewController.designer.cs"
Compilation succeeded - 1 warning(s)
/Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/SomeLibraryComponentViewController.cs(48,24): warning CS0672: Member `SomeLibraryComponent.SomeLibraryComponentViewController.ShouldAutorotateToInterfaceOrientation(MonoTouch.UIKit.UIInterfaceOrientation)' overrides obsolete member `MonoTouch.UIKit.UIViewController.ShouldAutorotateToInterfaceOrientation(MonoTouch.UIKit.UIInterfaceOrientation)'. Add the Obsolete attribute to `SomeLibraryComponent.SomeLibraryComponentViewController.ShouldAutorotateToInterfaceOrientation(MonoTouch.UIKit.UIInterfaceOrientation)'
/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll (Location of the symbol related to previous warning)
Build complete -- 0 errors, 1 warning
Compiling to native code
/Developer/MonoTouch/usr/bin/mtouch -sdkroot "/Applications/Xcode.app/Contents/Developer" --cache "/Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/obj/iPhone/Debug/mtouch-cache" --nomanifest --nosign -dev "/Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/bin/iPhone/Debug/SomeLibraryComponent.app" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" -r "/Users/somedeveloper/projects/SomeLibraryComponent/Components/SomeLibrary-1.0/lib/ios/SomeLibrary.iOS.dll" -debug -sdk "6.1" -targetver "6.0" --abi=armv7 "-v" "-v" "-v" "--compiler:clang++" "/Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/bin/iPhone/Debug/SomeLibraryComponent.exe"
Xamarin.iOS 7.0.1.4 (4cfca2f) Business Edition using framework: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk
Linking assembly /Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/bin/iPhone/Debug/SomeLibraryComponent.exe into /Users/somedeveloper/projects/SomeLibraryComponent/SomeLibraryComponent/obj/iPhone/Debug/mtouch-cache/PreBuild
error MT2002: Failed to resolve assembly: 'SomeLibrary, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
Failed to resolve assembly: 'SomeLibrary, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, Mono.Linker.LinkContext& context, System.Collections.Generic.List`1& assemblies) [0x00000] in <filename unknown>:0
at MTouch.LinkAssemblies (System.String main, System.Collections.Generic.List`1& assemblies, System.String output_dir, Mono.Linker.LinkContext& link_context) [0x00000] in <filename unknown>:0
at MonoTouch.Application.ManagedLink () [0x00000] in <filename unknown>:0
at MonoTouch.Application.ProcessAssemblies () [0x00000] in <filename unknown>:0
at MonoTouch.Application.BuildApp () [0x00000] in <filename unknown>:0
at MonoTouch.Application.Build () [0x00000] in <filename unknown>:0
at MTouch.Main2 (System.String[] args) [0x00000] in <filename unknown>:0
at MTouch.Main (System.String[] args) [0x00000] in <filename unknown>:0
It has nothing do to with public key (tokens).
From the first part of your log it seems that your .dll is named "SomeLibrary.iOS.dll". However the error message is looking for "SomeLibrary", not "SomeLibrary.iOS".
There must be a mismatch between the file name and the internal assembly name.
I got stuck here by copying a project and renaming the project file from Foundation.Mobile to Mobile. I kept on getting a "Component failed to resolve assembly". The answer was to change the actual assembly name in Project Properties.
Uninstall package "SomeLibrary" and install it again via Nuget Package Manager.
I was getting this same error (Failed to resolve assembly: 'SomeLibrary, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'), and that was the solution in my case.
I am facing problem to instal Xamarin in my Mac machine. It's giving problem in monotouch framework installation.
I have down loaded from http://xamarin.com and
down loaded file name is : XamarinInstaller.dmg
My Mac book specifications : lion 10.8.2
Please help me out..
I am getting below error.
Mono Framework installation failed with more than one exception (Attempt #Mono Framework)
Some installation errors are present.
Exception type: System.AggregateException
Message: Some installation errors are present.
Exception type: Xamarin.Web.Installer.InstallException
Message: Failed to attach DMG image '/Users/abcd.is/Library/Caches/XamarinInstaller/Universal/downloads/MonoFramework-MDK-2.10.12.macos10.xamarin.x86.dmg'. Error code 1.
at Xamarin.Web.Installer.MacInstallationArchiveHandler.MountDmg (System.String path) [0x00000] in :0
at Xamarin.Web.Installer.MacInstallationArchiveHandler.InstallDmg (System.String path, Boolean needsPrivileges) [0x00000] in :0
at Xamarin.Web.Installer.Installer.InstallationArchiveHandler.Install (System.String path, Boolean needsPrivileges) [0x00000] in :0
Exception type: Xamarin.Web.Installer.InstallException
Message: Failed to attach DMG image '/Users/abcd.is/Library/Caches/XamarinInstaller/Universal/downloads/MonoFramework-MDK-2.10.12.macos10.xamarin.x86.dmg'. Error code 1.
Actually, restarting the installer worked for me.
I have recently downloaded and installed Xcode 3 (!) together with SDK 4.3 (was on 4.2 before). Now i cannot deploy my app to iPad 2 (4.3.1) anymore. I get this error:
Please ensure your device is connected...
Connected to: René’s iPad
Initializing file service...
Uploading application
Finalizing file service...
Connected to: René’s iPad
Installing application
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
at MonoTouch.Installation.Installer.InstallApplication (object,System.EventArgs) <0x001b6>
at MonoTouch.Installation.Device.NotificationCallback (MonoTouch.Installation.Device/am_device_notification_callback_info&) <0x0006e>
at (wrapper native-to-managed) MonoTouch.Installation.Device.NotificationCallback (MonoTouch.Installation.Device/am_device_notification_callback_info&) <0x0003d>
at (wrapper managed-to-native) MonoTouch.CoreFoundation.CFRunLoop.CFRunLoopRun () <0x00003>
at MonoTouch.CoreFoundation.CFRunLoop.Run () <0x0000d>
at MonoTouch.Installation.Installer.InstallApplication (string) <0x00151>
at MTouch.Main (string[]) <0x032d1>
The application was terminated by a signal: SIGHUP
Your application name or path have a space in it. Remove the space and it should work.