System.MissingMethodException: Method 'Array.Empty' not found with MvvmCross on Xamarin.Android - xamarin.android

I have an application that is working fine in Debug / Release mode but, as soon as I try to deploy it via HockeyApp and VSTS, I get the following error on startup:
System.MissingMethodException: Method 'Array.Empty' not found.
at MvvmCross.Droid.Views.MvxActivityViewExtensions.OnViewCreate (IMvxAndroidView androidView, Android.OS.Bundle bundle) [0x00055] in <filename unknown>:0
at MvvmCross.Droid.Views.MvxActivityAdapter.EventSourceOnCreateCalled (System.Object sender, MvvmCross.Platform.Core.MvxValueEventArgs`1 eventArgs) [0x0000c] in <filename unknown>:0
at (wrapper delegate-invoke) System.EventHandler`1[MvvmCross.Platform.Core.MvxValueEventArgs`1[Android.OS.Bundle]]:invoke_void_object_TEventArgs (object,MvvmCross.Platform.Core.MvxValueEventArgs`1<Android.OS.Bundle>)
Also, I've noticed that if I try to use the following code:
var t = Array.Empty<object>();
VSTS is unable to compile my project, with the same error (System.MissingMethodException: Method 'Array.Empty' not found.)

Related

Fabric with Unity iOS - unable to configure app

I installed Fabric and Crashlytics without any problems last week, and when launching my iOS app via XCode I can see the setup messages
Fabric.Internal.Crashlytics.CrashlyticsInit:RegisterExceptionHandlers()
Fabric.Internal.Crashlytics.CrashlyticsInit:Awake()
in the output log, but my app isn't being registered by Fabric. If I log in to their site I am directed to https://www.fabric.io/onboard/pending, and can't seem to continue past "(1) Add the first SDK to your project". Is there a step I have perhaps missed, or a library I need to manually add?
I also tried throwing a non fatal exception after my app had launched, my understanding being that this should just throw an exception, but my app crashes and closes, with the following error being thrown in XCode. Is this normal?
NullReferenceException: A null value was found where an object instance was required.
at Fabric.Crashlytics.Internal.Impl.Log (System.String message) [0x00000] in <filename unknown>:0
at StartMenuController.OnClickParentModeBtn () [0x00000] in <filename unknown>:0
at UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters) [0x00000] in <filename unknown>:0
at ButtonAnimator+<InvokeEvent>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0
at UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00000] in <filename unknown>:0

Facebook unity3d sdk 6.0 does not work in ios simulator

Facebook requires us to submit the app as a simulator build for them to review.
I did that, but when I run it in simulator, I get the exception:
Symbol file /Users/AMI/Library/Application Support/iPhone Simulator/7.1/Applications/D2633BCE-B3F0-4B4B-910B-34E3F2FFF403/Testing.app/Data/Managed/System.dll.mdb doesn't match image /Users/TESTER/Library/Application Support/iPhone Simulator/7.1/Applications/D2633BCE-B3F0-4B4B-910B-34E3F2FFF403/Testing.app/Data/Managed/System.dll
EntryPointNotFoundException: iosInit
at (wrapper managed-to-native) Facebook.IOSFacebook:iosInit (string,bool,bool,bool,bool,string)
at Facebook.IOSFacebook.Init (Facebook.InitDelegate onInitComplete, System.String appId, Boolean cookie, Boolean logging, Boolean status, Boolean xfbml, System.String channelUrl, System.String authResponse, Boolean frictionlessRequests, Facebook.HideUnityDelegate hideUnityDelegate) [0x00000] in <filename unknown>:0
at FB.OnDllLoaded () [0x00000] in <filename unknown>:0
at FB+CompiledFacebookLoader.Start () [0x00000] in <filename unknown>:0
What could be causing this? If I cannot get this to work, I will not be able to submit the app to be approved by Facebook which means we can not make our app work with Facebook.
Thanks.
Found the reason, another plugin have the post build step which modify the same file as facebook does. Disable that and there is no more issue.

iOS black screen and MissingMethodException: Method not found: 'System.Type.op_Equality'

I'm starting to create an app using MvvmCross. So far I have an version for Android and for WP running. Unfortunately, creating the app for iOS isn't easy. When running the iOS-app in the simulator, I only get a black screen. In MonoDevelop's Application Output is see the following exception:
2013-01-07 10:42:20.506 BestSellersTouch[319:21e03] mvx: Diagnostic: 0.09 Exception masked MissingMethodException: Method not found: 'System.Type.op_Equality'.
at Cirrious.MvvmCross.Touch.Views.Presenters.MvxTouchViewPresenter.CreateView (Cirrious.MvvmCross.Views.MvxShowViewModelRequest request) [0x00000] in <filename unknown>:0
at Cirrious.MvvmCross.Touch.Views.Presenters.MvxTouchViewPresenter.Show (Cirrious.MvvmCross.Views.MvxShowViewModelRequest request) [0x00000] in <filename unknown>:0
at Cirrious.MvvmCross.Touch.Views.MvxTouchViewDispatcher+<>c__DisplayClass4.<RequestNavigate>b__3 () [0x00000] in <filename unknown>:0
at Cirrious.MvvmCross.Touch.Views.MvxTouchUIThreadDispatcher+<>c__DisplayClass1.<InvokeOrBeginInvoke>b__0 () [0x00000] in <filename unknown>:0
2013-01-07 10:42:20.508 BestSellersTouch[319:21e03] Application windows are expected to have a root view controller at the end of application launch
Is this error causing a black screen?
References to System.Type.op_Equality only exists when an assembly is compiled against mscorlib.dll 4.0 (and later).
Current version of MonoTouch does not support 4.0 (and that member is not part of the assembly) which result in this exception at runtime.
The solution, until MonoTouch supports 4.0 (this spring) is to rebuild the assembly and make sure it referenes the mscorlib.dll that ships with MonoTouch.
The fact that this exception is thrown while presenting a view is likely the reason of your black screen (nothing got executed to show anything on it).

xib is not opened in Xcode in a default MonoTouch application

I've just created a MonoTouch solution using MonoDevelop and after I'm trying open the xib in XCode for editing, I get the following exception (and the xib not opens):
System.NotSupportedException: Custom attribute type 0x43 is not supported.
at ICSharpCode.NRefactory.TypeSystem.CecilLoader+BlobReader.ReadCustomAttributeFieldOrPropType () [0x00000] in <filename unknown>:0
at ICSharpCode.NRefactory.TypeSystem.CecilLoader+BlobReader.ReadNamedArg (IType attributeType) [0x00000] in <filename unknown>:0
at ICSharpCode.NRefactory.TypeSystem.CecilLoader+CecilResolvedAttribute.DecodeBlob (System.Collections.Generic.List`1 positionalArguments, System.Collections.Generic.List`1 namedArguments) [0x00000] in <filename unknown>:0
at ICSharpCode.NRefactory.TypeSystem.CecilLoader+CecilResolvedAttribute.DecodeBlob () [0x00000] in <filename unknown>:0
at ICSharpCode.NRefactory.TypeSystem.CecilLoader+CecilResolvedAttribute.get_PositionalArguments () [0x00000] in <filename unknown>:0
at MonoDevelop.MacDev.ObjCIntegration.NSObjectInfoService.ConvertType (MonoDevelop.Ide.TypeSystem.ProjectContentWrapper dom, ITypeDefinition type) [0x00000] in <filename unknown>:0
at MonoDevelop.MacDev.ObjCIntegration.NSObjectInfoService+<GetRegisteredObjects>c__Iterator2.MoveNext () [0x00000] in <filename unknown>:0
at MonoDevelop.MacDev.ObjCIntegration.NSObjectProjectInfo.Update () [0x00000] in <filename unknown>:0
at MonoDevelop.MacDev.ObjCIntegration.NSObjectProjectInfo.Update (Boolean force) [0x00000] in <filename unknown>:0
at MonoDevelop.MacDev.XcodeSyncing.XcodeProjectTracker.UpdateTypes (IProgressMonitor monitor) [0x00000] in <filename unknown>:0
The application compiles and run fine though....
Restart XCode and MonoTouch, it should solve this problem...
I restarted MonoDevelop and XCode, but still had the same problem. Until I find a better solution, I am doing it this way:
Open an existing solution in XCode.
Open the xib file to lauch the Interface Builder (from within XCode).
While in Interface Builder, go File>Open.
Navigate to the xib file that was created in MonoDevelop.
I can't find a way of launching the Interface Builder without opening an existing XCode solution.
I tried restarting/reinstalling/rebooting to no avail.
I solved my issue by removing a reference to a Portable Library project I created in the same solution. Portable Library claims it supports MonoTouch, but perhaps it is not meant to reference MonoTouch itself (because then it wouldn't be portable to other platforms.) I did get some compilation warnings related to it referencing MonoTouch.
Instead, I created a new project from the MonoTouch Library Project project template, moved my files there, and I can again edit XIB's / Storyboards as expected in the Interface Builder from MonoDevelop.
Alternative: Instead of creating a new project and moving my files, what I actually did was changed the <ProjectTypeGuids>...</ProjectTypeGuids> in my csproj file to match the MonoTouch Library project, as this was easier for me:
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3
-BF4B-00C04F79EFBC}</ProjectTypeGuids>

Possible bundle problems - Cannot create an NSPersistentStoreCoordinator with a nil model

I want to integrate the Aviary SDK Objective-C library into Monotouch project. I use 'Monotouch Binding Project' template for this.
I have built the DLL (Thanks smart people!) The project is compiled and run on the simulator.
However I can NOT show the main Aviary view and the following code
this.afPhotoEditor = new AFPhotoEditorController(UIImage.FromFile("Images/site.jpg"));
AFDelegate afDelegate = new AFDelegate(this);
this.afPhotoEditor.Delegate = afDelegate;
this.PresentModalViewController(this.afPhotoEditor, true);
returns the error:
Unhandled Exception: MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: Cannot create an NSPersistentStoreCoordinator with a nil model
at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSendSuper_IntPtr_bool (intptr,intptr,intptr,bool)
at MonoTouch.UIKit.UIViewController.PresentModalViewController (MonoTouch.UIKit.UIViewController modalViewController, Boolean animated) [0x00038] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIViewController.g.cs:261
at TestAviary.FirstViewController.<ViewDidLoad>m__0 (System.Object , System.EventArgs ) [0x00028] in /Users/mahmood1/Projects/AviaryBinding/TestAviary/FirstViewController.cs:61
at MonoTouch.UIKit.UIControlEventProxy.Activated () [0x00000] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIControl.cs:30
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) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
at TestAviary.Application.Main (System.String[] args) [0x00000] in /Users/mahmood1/Projects/AviaryBinding/TestAviary/Main.cs:17
[ERROR] FATAL UNHANDLED EXCEPTION: MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: Cannot create an NSPersistentStoreCoordinator with a nil model
at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSendSuper_IntPtr_bool (intptr,intptr,intptr,bool)
at MonoTouch.UIKit.UIViewController.PresentModalViewController (MonoTouch.UIKit.UIViewController modalViewController, Boolean animated) [0x00038] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIViewController.g.cs:261
at TestAviary.FirstViewController.<ViewDidLoad>m__0 (System.Object , System.EventArgs ) [0x00028] in /Users/mahmood1/Projects/AviaryBinding/TestAviary/FirstViewController.cs:61
at MonoTouch.UIKit.UIControlEventProxy.Activated () [0x00000] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIControl.cs:30
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) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
at TestAviary.Application.Main (System.String[] args) [0x00000] in /Users/mahmood1/Projects/AviaryBinding/TestAviary/Main.cs:17
It seems this error (Cannot create an NSPersistentStoreCoordinator with a nil model) is linked with resource bundle what Aviary SDK requires to add.
From Aviary iOS Setup Guide:
4. Copy resources
Make sure AviarySDKResources.bundle is included in your target's "Copy Bundle Resources" build phase.
So I added this bundle via 'Add Existing Folder..' menu item in MonoDevelop.
Sources are placed here >>> http://www.axifile.com/en/71EC96914A
It includes 2 projects:
AviaryBinding (MonoTouch Binding Project)
TestAviary
Thank you!
Per Jonathan.Peppers comment:
Adding most files like this to your project with Build Action of Content will solve the issue.

Resources