Missing method exception when referencing Google Maps class - c#

I'm getting a System.MissingMethodException when I try to instantiate a Dictionary using the Android.Gms.Maps.Model.Marker class as follows:
Dictionary<Marker, MyInnerClass> _markers = new Dictionary<Marker, MyInnerClass>();
I suspect that somehow a needed dll is not being loaded but don't know why. The problem seems to be specific to my specific dev environment since other developers with the same code are not seeing this problem. I can reproduce the issue in Genymotion, an Asus Tablet and a GS4 all running Android 4.2.2.
Application output reports the following:
[] Missing method Android.Runtime.JNIEnv::AllocObject(Type) in assembly Mono.Android.dll, referenced in assembly GooglePlayServices.dll
Here's the stack trace:
System.MissingMethodException: Method not found: 'Android.Runtime.JNIEnv.AllocObject'.
at MyProduct.Maps.MyMapFragment..ctor () [0x00013] in /Users/me/code/my.domain/MyProduct/Maps/MyMapFragment.cs:48
at at (wrapper dynamic-method) object.ffa689fb-fdde-4e08-abd8-3bdf6ae641fb (intptr,object[]) <IL 0x00018, 0x00037>
at Java.Interop.TypeManager.n_Activate (intptr,intptr,intptr,intptr,intptr,intptr) [0x00070] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.8.2-branch/a25a31d0/source/monodroid/src/Mono.Android/src/Java.Interop/TypeManager.cs:141
at at (wrapper native-to-managed) Java.Interop.TypeManager.n_Activate (intptr,intptr,intptr,intptr,intptr,intptr) <IL 0x00020, 0x0007f>
at at (wrapper managed-to-native) object.wrapper_native_0xb65e0e20 (intptr,intptr,intptr,intptr,Android.Runtime.JValue[]) <0x00003>
at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) [0x00000] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.8.2-branch/a25a31d0/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:612
at Android.App.Activity.SetContentView (int) [0x00070] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.8.2-branch/a25a31d0/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.App.Activity.cs:3824
at MyProduct.MyListActivity.OnCreate (Android.OS.Bundle) [0x00079] in /Users/me/code/my.domain/MyProduct/MyListActivity.cs:83
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.8.2-branch/a25a31d0/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.App.Activity.cs:1937
at at (wrapper dynamic-method) object.24a01956-09ee-4dec-9155-eff468f7249c (intptr,intptr,intptr) <IL 0x00017, 0x0001f>

Android.Runtime.JNIEnv.AllocObject() is a method that was added to Xamarin.Android 4.10.1.
It would seem that GooglePlayServices.dll was built against 4.10, while your app was packaged against 4.8 (which doesn't contain AllocObject()). This would explain the MissingMethodException.
Xamarin.Android 4.10.1 is now stable; please upgrade.

Related

ThreadPool or Timers tasks are not waiting properly

After updating Android's Support Libraries (v28.0+) to get targeted with monoandroid90, the app crashes sometimes with the stack trace I provided bellow. If there are breakpoints active this won't happen.
Different versions of Xamarin.Android were tested, the current one I'm using is the latest 9.4 that comes with the default vs19. I was not able to reproduce this on a fresh install of the vs17 with the default XA that comes with it (9.1.7.0)
The following stack trace shows the current problem I'm facing.
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () <0x00007>
at (wrapper runtime-invoke) <Module>.runtime_invoke_bool (object,intptr,intptr,intptr) [0x0002b] in <ff07eae8184a40a08e79049bbcb31a0e>:0
"Finalizer"08-06 16:26:25.748 E/mono (11487): Full thread dump:
"Thread Pool Worker" at <unknown> <0xffffffff>
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () <0x00007>
at (wrapper runtime-invoke) <Module>.runtime_invoke_bool (object,intptr,intptr,intptr) [0x0002b] in <ff07eae8184a40a08e79049bbcb31a0e>:0
"Debugger agent"
"Timer-Scheduler" at <unknown> <0xffffffff>
at (wrapper managed-to-native) System.Threading.WaitHandle.Wait_internal (intptr*,int,bool,int) <0x00007>
at System.Threading.WaitHandle.WaitOneNative (System.Runtime.InteropServices.SafeHandle,uint,bool,bool) [0x0001f] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.WaitHandle.InternalWaitOne (System.Runtime.InteropServices.SafeHandle,long,bool,bool) [0x00019] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.WaitHandle.WaitOne (long,bool) [0x00010] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.WaitHandle.WaitOne (int,bool) [0x0001d] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.WaitHandle.WaitOne (int) [0x00003] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.Timer/Scheduler.SchedulerThread () [0x00043] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.ThreadHelper.ThreadStart_Context (object) [0x0001f] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00073] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00004] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object) [0x0002f] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at System.Threading.ThreadHelper.ThreadStart () [0x00014] in <ff07eae8184a40a08e79049bbcb31a0e>:0
at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) [0x00067] in <ff07eae8184a40a08e79049bbcb31a0e>:0
"<unnamed thread>"
08-06 16:26:35.755 I/libc (11487): Requested dump for tid 11487 (ler.challengeme)
Anybody else has ever faced this issue and is aware of a possible solution?

The type initializer for 'Microsoft.WindowsAzure.Storage.CloudStorageAccount' threw an exception error in Xamarin.forms

I'm working on AzureStorage cloud solution provided by Xamarin.
https://developer.xamarin.com/guides/xamarin-forms/cloud-services/storage/azure-storage/
And this is what I got in GetContainer() method.
The type initializer for
'Microsoft.WindowsAzure.Storage.CloudStorageAccount' threw an
exception
I applied my connection string in the sample project and it worked, but not in my own project.
Has anyone ever faced this issue? Please help me.
Thanks in advance.
Error message :
System.TypeInitializationException: The type initializer for 'Microsoft.WindowsAzure.Storage.CloudStorageAccount' threw an exception. ---> System.NotImplementedException: The method or operation is not implemented.
at Microsoft.WindowsAzure.Storage.CloudStorageAccount.Setting (System.String name, System.String[] validValues) [0x00000] in <667a5fa37f124e50ab7a68ecb3437b13>:0
at Microsoft.WindowsAzure.Storage.CloudStorageAccount..cctor () [0x00000] in <667a5fa37f124e50ab7a68ecb3437b13>:0
--- End of inner exception stack trace ---
at MyTenantWorld.AzureStorage.GetContainer (MyTenantWorld.ContainerType containerType) [0x00020] in <9816076ee17d42efaf1050c5169a4310>:0
at MyTenantWorld.AzureStorage+<UploadFileAsync>d__3.MoveNext () [0x0001a] in <9816076ee17d42efaf1050c5169a4310>:0
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <3fd174ff54b146228c505f23cf75ce71>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <3fd174ff54b146228c505f23cf75ce71>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <3fd174ff54b146228c505f23cf75ce71>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <3fd174ff54b146228c505f23cf75ce71>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <3fd174ff54b146228c505f23cf75ce71>:0
at MyTenantWorld.SettingsPage+<SaveData>d__20.MoveNext () [0x00309] in <9816076ee17d42efaf1050c5169a4310>:0
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <3fd174ff54b146228c505f23cf75ce71>:0
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in <3fd174ff54b146228c505f23cf75ce71>:0
at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <d855bac285f44dda8a0d8510b679b1e2>:0
at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <d855bac285f44dda8a0d8510b679b1e2>:0
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <d855bac285f44dda8a0d8510b679b1e2>:0
at at (wrapper dynamic-method) System.Object:a4fed05a-cd7a-4756-85bb-5dd975374042 (intptr,intptr)
As the GetContainer method defined under AzureStorage.cs as follows:
static CloudBlobContainer GetContainer(ContainerType containerType)
{
var account = CloudStorageAccount.Parse(Constants.StorageConnection);
var client = account.CreateCloudBlobClient();
return client.GetContainerReference(containerType.ToString().ToLower());
}
It seems that the error was thrown by CloudStorageAccount.Parse, but from BergQuester's link about CloudStorageAccount.Parse, we could find that this error is not from the predictable exceptions.
From your stack trace, we could find the error was thrown at Setting(string name, params string[] validValues) from CloudStorageAccount.cs. I used WindowsAzure.Storage 8.3.0 and tested it under my BruceChen_Mobile.UWP project and PCL project, it could work as expected with my azure storage connection string.
I applied my connection string in the sample project and it worked, but not in my own project.
I would recommend you checking the packages between your application and the xamarin-forms-samples. Or you could provide a reproducible sample project for us to narrow this issue.
I fixed this issue on mine by adding a reference to the WindowsAzure.Storage nuget package from my native projects (not just in the PCL project), as it requires some native implementations that are defined in these references.

Xamarin Binding "Wrapper type '' is missing its native ObjectiveC Class

I am trying to bind an external accessory MSR SDK to Xamarin. Note, this is ON the device. It does not work in the simulator at all. I keep getting this error:
Wrapper type 'iMagProII.IMag' is missing its native ObjectiveC class 'IMag'.
Here is my .cs with my linker flags:
[assembly: LinkWith ("libiMagSDK.a", LinkTarget = LinkTarget.ArmV6 | LinkTarget.ArmV7 | LinkTarget.Simulator, SmartLink = true, ForceLoad = true, IsCxx = true, Frameworks = "CoreGraphics ExternalAccessory", LinkerFlags="-lsqlite3.0 -lc++")]
Here is the Stack Trace:
at MonoTouch.Registrar.DynamicRegistrar.OnRegisterType (MonoTouch.Registrar.ObjCType type) [0x00334] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/.pmcs-compat.DynamicRegistrar.cs:573
at MonoTouch.Registrar.Registrar.RegisterTypeUnsafe (System.Type type, System.Collections.Generic.List`1& exceptions) [0x009a4] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/.pmcs-compat.Registrar.cs:1027
at MonoTouch.Registrar.Registrar.RegisterType (System.Type type, System.Collections.Generic.List`1& exceptions) [0x00011] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/.pmcs-compat.Registrar.cs:680
at MonoTouch.Registrar.DynamicRegistrar.Register (System.Type type) [0x00002] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/.pmcs-compat.DynamicRegistrar.cs:839
at MonoTouch.ObjCRuntime.Class.Register (System.Type type) [0x00000] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/.pmcs-compat.Class.cs:126
at MonoTouch.ObjCRuntime.Class.GetHandle (System.Type type) [0x00000] in <filename unknown>:0
at MonoTouch.Foundation.NSObject.AllocIfNeeded () [0x00015] in /Developer/MonoTouch/Source/maccore/src/Foundation/.pmcs-compat.NSObject2.cs:390
at MonoTouch.Foundation.NSObject..ctor (MonoTouch.Foundation.NSObjectFlag x) [0x00006] in /Developer/MonoTouch/Source/maccore/src/Foundation/.pmcs-compat.NSObject2.cs:102
at iMagProII.IMag..ctor () [0x00000] in /Users//Projects/Xamarin/Bindings/Unimag/iMagProII/obj/Debug/ios/iMagProII/IMag.g.cs:112
at iMagProII.iOS.ImagViewController.ViewDidLoad () [0x0005c] in /Users//Projects/Xamarin/Bindings/Unimag/iMagProII.iOS/ImagViewController.cs:46
at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:IntPtr_objc_msgSendSuper (intptr,intptr)
at MonoTouch.UIKit.UIViewController.get_View () [0x00030] in /Developer/MonoTouch/Source/monotouch/src/build/compat/UIKit/.pmcs-compat.UIViewController.g.cs:2232
at iMagProII.iOS.ImagViewController..ctor () [0x00008] in /Users//Projects/Xamarin/Bindings/Unimag/iMagProII.iOS/ImagViewController.cs:23
at iMagProII.iOS.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x00016] in /Users//Projects/Xamarin/Bindings/Unimag/iMagProII.iOS/AppDelegate.cs:33
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/.pmcs-compat.UIApplication.cs:38
at iMagProII.iOS.Application.Main (System.String[] args) [0x00008] in /Users//Projects/Xamarin/Bindings/Unimag/iMagProII.iOS/Main.cs:17
Any help on getting this library bound would be greatly appreciated. I have been banging my head at it for hours now.
This occurs when the class IMag can't be found in the final executable.
The most common reasons for this are:
A typo in the class name.
The native library does not include the architecture you're building for. For instance the native library needs to contain i386 code to run in the simulator. You can use the lipo tool to list the architectures in the native library:
$ lipo -info /path/to/libiMagSDK.a
You also need to know the architecture you're using for the app, you can check this in the project's iOS Build settings, on the Advanced page. Select one that the native library includes.
The native library in the binding project depends on another native library which is not in the binding project (and the IMag class is in that other library). All non-platform dependencies must be included.
The native library is incorrectly built, and doesn't include the class you're trying to bind (this is not frequent, but I've still seen it several times). You can use the nm tool to check what's included in a native library:
$ nm -arch armv7 /path/to/libiMagSDK.a | grep IMag
0x0000f00d S _OBJC_CLASS_$_IMag
[other results]
The above result would indicate that the class is included in the native library.

monogame content load file not found exception

The following post looks similar to my issue, but ultimately it doesn't look exactly the same down to all the details, so I am calling that out to prevent claims that its the same.
I am following this monogame tutorial (currently on step 2) in Xamarin Studio:
When I run the resulting monogame app at the end of step 2 I get the following exception (pasted at the end) when I hit the line of code that attempts to load the player content. I have the player content file setup correctly AFAIK, its copied to the output folder, but I am assuming that its somehow not deployed correctly to the Andriod Virtual Machine (AVM), which I have not been able to figure out how to examine the deployed contents. I pulled up Android Monitor to explore the AVM and try to figure out where things are, but I haven't had any luck figuring that out... The file not found exception seems to be clear that what's running on the AVM isn't finding the content file... but I can't figure out how to correct that.
Any help would be appreciated, thanks!
The sources and project that I am having this issue with are here
The exception I am seeing is the following:
[MonoDroid] UNHANDLED EXCEPTION: Microsoft.Xna.Framework.Content.ContentLoadException: Could not load Graphics\player asset as a non-content file! ---> Microsoft.Xna.Framework.Content.ContentLoadException: Opening stream error. ---> Java.IO.FileNotFoundException: Exception of type 'Java.IO.FileNotFoundException' was thrown. [MonoDroid] at Android.Runtime.JNIEnv.CallObjectMethod (IntPtr jobject, IntPtr jmethod, Android.Runtime.JValue[] parms) [0x00000] in :0 [MonoDroid] at Android.Content.Res.AssetManager.Open (System.String fileName) [0x00000] in :0 [MonoDroid] at Microsoft.Xna.Framework.TitleContainer.OpenStream (System.String name) [0x00000] in :0 [MonoDroid] at Microsoft.Xna.Framework.Content.ContentManager.OpenStream (System.String assetName) [0x00000] in :0 [MonoDroid] --- End of managed exception stack trace --- [MonoDroid] java.io.FileNotFoundException: Content/Graphics/player.xnb [MonoDroid] at android.content.res.AssetManager.openAsset(Native Method) [MonoDroid] at android.content.res.AssetManager.open(AssetManager.java:315) [MonoDroid] at android.content.res.AssetManager.open(AssetManager.java:289) [MonoDroid] at mono.java.lang.RunnableImplementor.n_run(Native Method) [MonoDroid] at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29) [MonoDroid] at android.os.Handler.handleCallback(Handler.java:605) [MonoDroid] at android.os.Handler.dispatchMessage(Handler.java:92) [MonoDroid] at android.os.Looper.loop(Looper.java:137) [MonoDroid] at android.app.ActivityThread.main(ActivityThread.java:4424) [MonoDroid] at java.lang.reflect.Method.invokeNative(Native Method) [MonoDroid] at java.lang.reflect.Method.invoke(Method.java:511) [MonoDroid] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) [MonoDroid] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) [MonoDroid] at dalvik.system.NativeStart.main(Native Method) [MonoDroid] [MonoDroid] --- End of inner exception stack trace --- [MonoDroid] at Microsoft.Xna.Framework.Content.ContentManager.OpenStream (System.String assetName) [0x00000] in :0 [MonoDroid] at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[Texture2D] (System.String assetName, System.Action1 recordDisposableObject) [0x00000] in :0
[MonoDroid] --- End of inner exception stack trace ---
[MonoDroid] at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset (string,System.Action1) <0x0042c> [MonoDroid] at Microsoft.Xna.Framework.Content.ContentManager.Load (string) <0x000c3> [MonoDroid] at SampleShooter.Game1.LoadContent () <0x0018b> [MonoDroid] at Microsoft.Xna.Framework.Game.Initialize () <0x0023f> [MonoDroid] at SampleShooter.Game1.Initialize () <0x00037> [MonoDroid] at Microsoft.Xna.Framework.Game.DoInitialize () <0x00037> [MonoDroid] at Microsoft.Xna.Framework.AndroidGamePlatform.BeforeUpdate (Microsoft.Xna.Framework.GameTime) <0x0002b> [MonoDroid] at Microsoft.Xna.Framework.Game.DoUpdate (Microsoft.Xna.Framework.GameTime) <0x0002f> [MonoDroid] at Microsoft.Xna.Framework.Game.Tick () <0x00493> [MonoDroid] at Microsoft.Xna.Framework.AndroidGameWindow.OnUpdateFrame (OpenTK.FrameEventArgs) <0x000a7> [MonoDroid] at OpenTK.Platform.Android.AndroidGameView.UpdateFrameInternal (OpenTK.FrameEventArgs) <0x00033> [MonoDroid] at OpenTK.Platform.Android.AndroidGameView.RunIteration (System.Threading.CancellationToken) <0x001c3> [MonoDroid] at OpenTK.Platform.Android.AndroidGameView/c__AnonStorey0.<>m__2 (object) <0x00027> [MonoDroid] at Android.App.SyncContext/c__AnonStorey2F.<>m__1A () <0x00023> [MonoDroid] at Java.Lang.Thread/RunnableImplementor.Run () <0x0003f> [MonoDroid] at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) <0x00037> [MonoDroid] at (wrapper dynamic-method) object.e85befee-f4e0-4f15-9232-77621081c7b5 (intptr,intptr) <0x0003b> [mono] [mono] Unhandled Exception: [mono] Microsoft.Xna.Framework.Content.ContentLoadException: Could not load Graphics\player asset as a non-content file! ---> Microsoft.Xna.Framework.Content.ContentLoadException: Opening stream error. ---> Java.IO.FileNotFoundException: Exception of type 'Java.IO.FileNotFoundException' was thrown. [mono] at Android.Runtime.JNIEnv.CallObjectMethod (IntPtr jobject, IntPtr jmethod, Android.Runtime.JValue[] parms) [0x00000] in :0 [mono] at Android.Content.Res.AssetManager.Open (System.String fileName) [0x00000] in :0 [mono] at Microsoft.Xna.Framework.TitleContainer.OpenStream (System.String name) [0x00000] in :0 [mono] at Microsoft.Xna.Framework.Content.ContentManager.OpenStream (System.String assetName) [0x00000] in :0 [mono] --- End of managed exception stack trace --- [mono] java.io.FileNotFoundException: Content/Graphics/player.xnb [mono] at android.content.res.AssetManager.openAsset(Native Method) [mono] at android.content.res.AssetManager.open(AssetManager.ja [mono] [ERROR] FATAL UNHANDLED EXCEPTION: Microsoft.Xna.Framework.Content.ContentLoadException: Could not load Graphics\player asset as a non-content file! ---> Microsoft.Xna.Framework.Content.ContentLoadException: Opening stream error. ---> Java.IO.FileNotFoundException: Exception of type 'Java.IO.FileNotFoundException' was thrown. [mono] at Android.Runtime.JNIEnv.CallObjectMethod (IntPtr jobject, IntPtr jmethod, Android.Runtime.JValue[] parms) [0x00000] in :0 [mono] at Android.Content.Res.AssetManager.Open (System.String fileName) [0x00000] in :0 [mono] at Microsoft.Xna.Framework.TitleContainer.OpenStream (System.String name) [0x00000] in :0 [mono] at Microsoft.Xna.Framework.Content.ContentManager.OpenStream (System.String assetName) [0x00000] in :0 [mono] --- End of managed exception stack trace --- [mono] java.io.FileNotFoundException: Content/Graphics/player.xnb [mono] at android.content.res.AssetManager.openAsset(Native Method) [mono] at android.content.res.AssetManager.open(As
So I finally figured out that I needed to mark the XNB file as an AndroidAsset for the build action, and not Content as the example stated. Since the example I am following is aimed at Windows Mobile development this makes sense since the file would normally be marked as content for a Windows application, whereas for Android these files need to be marked as AndriodAsset in order for XNA to be able to access the raw content data, regardless of if the file is in a content or asset folder. The content manager's root folder by default is "Content", so you need to add the file there and mark it as an asset, not content...
Content for an android monogame project should be added to the project in the Assets/Content folder as built .xnb files rather than just copied to the output directory

How to debug a Mono project that builds but can't run?

How do I debug a mono project? I can't seem to run it. It builds perfectly. But running it is another issue altogether.
This is the output from running it.
$ mono SvnTest.exe update
Stacktrace:
at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal.PtrToStringAnsi (intptr) <0x00045>
at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal.PtrToStringAnsi (intptr) <0x00045>
at PumaCode.SvnDotNet.AprSharp.AprString.ToString () <0x0004b>
at PumaCode.SvnDotNet.SubversionSharp.SvnException.ExtractMessage (PumaCode.SvnDotNet.SubversionSharp.SvnError) <0x00033>
at PumaCode.SvnDotNet.SubversionSharp.SvnException..ctor (PumaCode.SvnDotNet.SubversionSharp.SvnError) <0x0001b>
at PumaCode.SvnDotNet.SubversionSharp.SvnClient.Update (PumaCode.SvnDotNet.SubversionSharp.SvnPath,PumaCode.SvnDotNet.SubversionSharp.SvnOptRevision,bool,PumaCode.SvnDotNet.SubversionSharp.SvnClientContext,PumaCode.SvnDotNet.AprSharp.AprPool) <0x000e3>
at PumaCode.SvnDotNet.SubversionSharp.SvnClient.Update (string,PumaCode.SvnDotNet.SubversionSharp.SvnRevision,bool) <0x0009f>
at PumaCode.SvnDotNet.SubversionSharp.SvnMockApp.UpdateCmd.Execute () <0x0015f>
at PumaCode.SvnDotNet.SubversionSharp.SvnMockApp.CmdBase.Run (PumaCode.SvnDotNet.SubversionSharp.SvnMockApp.Application/SubCommand,string[]) <0x00551>
at (wrapper runtime-invoke) <Module>.runtime_invoke_int__this___object_object (object,intptr,intptr,intptr) <0x00060>
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (object,object[],System.Exception&) <0x00057>
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (object,object[],System.Exception&) <0x00057>
at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <0x001ab>
at System.Reflection.MethodBase.Invoke (object,object[]) <0x0002d>
at PumaCode.SvnDotNet.SubversionSharp.SvnMockApp.Application.Run (string[]) <0x0034b>
at PumaCode.SvnDotNet.SubversionSharp.SvnMockApp.Application.Main (string[]) <0x00037>
at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) <0x00054>
Native stacktrace:
mono() [0x48419c]
mono() [0x4ce1bf]
/lib/libpthread.so.0(+0xee80) [0x7f64b72b2e80]
/lib/libc.so.6(strlen+0x12) [0x7f64b6d477c2]
mono(mono_string_new+0x1d) [0x57f80d]
[0x4047e705]
Debug info from gdb:
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
Aborted
toString() method
public override string ToString()
{
if(IsNull)
return ("[apr_string:NULL]");
else
return (Marshal.PtrToStringAnsi(mString));
}
Clearly the mString member contains a garbage pointer. Judging from the call stack, you'll need help from the SubversionSharp team. Or find out somehow why it is trying to handle a Subversion error.
The last post at their web site dates from 2006, "We're not dead!". Their forum server looks pretty dead to me though. Good luck.

Categories

Resources