Exception when creating new Iphone/Ipad window in MonoDevelop - monodevelop

I get this exception every time i try to create a new Iphone/Ipad solution?
I have been following the guides and have both XCode, interface builder and IOS SDK installed.
Any clues are welcome:)
System.ApplicationException: Can't create display binding for mime type: application/vnd.apple-interface-builder
at MonoDevelop.Ide.Gui.Workbench.NewDocument (System.String defaultName, System.String mimeType, System.IO.Stream content) [0x00000] in :0
at MonoDevelop.Ide.Templates.FileTemplate.CreateFile (MonoDevelop.Ide.Templates.FileDescriptionTemplate newfile, MonoDevelop.Projects.SolutionItem policyParent, MonoDevelop.Projects.Project project, System.String directory, System.String language, System.String name) [0x00000] in :0
at MonoDevelop.Ide.Templates.FileTemplate.Create (MonoDevelop.Projects.SolutionItem policyParent, MonoDevelop.Projects.Project project, System.String directory, System.String language, System.String name) [0x00000] in :0
at MonoDevelop.Ide.Projects.NewFileDialog.OpenEvent (System.Object sender, System.EventArgs e) [0x00000] in :0

It appears that you are trying to create a new file, not a new project/solution.

Related

Is GroupMailBox missing from enum MailboxType?

We’re have a sporadic problem with EWS mail users. In the stack trace we see
System.ArgumentException: Requested value 'GroupMailbox' was not found.'
Findings
This is the StackTrace :
at System.Enum.TryParseEnum (System.Type enumType, System.String value, Boolean ignoreCase, System.EnumResult& parseResult) <0x10087d640 + 0x0052b>
in <filename unknown>:0
at System.Enum.Parse (System.Type enumType, System.String value, Boolean ignoreCase) <0x1006b91a8 + 0x00057>
in <filename unknown>:0
at Microsoft.Exchange.WebServices.Data.EwsUtilities.Parse[T] (System.String value) <0x10114e1ac + 0x000e3>
in <filename unknown>:0
at Microsoft.Exchange.WebServices.Data.EwsXmlReader.ReadValue[T] () <0x10114e764 + 0x00053>
in <filename unknown>:0
at Microsoft.Exchange.WebServices.Data.EwsXmlReader.ReadElementValue[T] () <0x10114e078 + 0x00087>
in <filename unknown>:0
at Microsoft.Exchange.WebServices.Data.EmailAddress.TryReadElementFromXml (Microsoft.Exchange.WebServices.Data.EwsServiceXmlReader reader) <0x1010a4330 + 0x00187>
at Microsoft.Exchange.WebServices.Data.EmailAddress.TryReadElementFromXml (Microsoft.Exchange.WebServices.Data.EwsServiceXmlReader reader) <0x1010a4330 + 0x00187>
In the source we thing this method
EmailAddress :: TryReadElementFromXml
case XmlElementNames.MailboxType:
this.mailboxType = reader.ReadElementValue<MailboxType>();
Analysis:
We believe that for some messages a MailboxType enum is trying to be parsed. However the enum MailboxType does not contain the value GroupMailbox and therefore throws an exception.
This is the documentation for the MailboxType enum
https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.mailboxtype%28v=exchg.80%29.aspx?f=255&MSPPError=-2147217396
Is it possible that the server logic was updated on the enum was not kept up-to-date???
Furthermore:
Also we’ve traced it down to the method in EWSUtilities.cs
internal static T Parse<T>(string value)
The else clause is
else
{
return (T)Enum.Parse(typeof(T), value, false);
}
Which should be reserved for when the enumeration is not found??? And instead of doing a TryParse its doing a Parse which fails.
This apparently is also a bug???
The Source for the EWS Managed API is on GitHub and I believe this has been updated with then new Enum https://github.com/OfficeDev/ews-managed-api/blob/154dbc66ac018d861c73ce489839cd9f58a1b0cd/Enumerations/MailboxType.cs . You should be compiling and using the latest source from GitHub as the latest release version and NuGet version released predates the change. (Microsoft should really be updating NuGet package to avoid issues).

could not load plugin assembly for type Cirrious.MvvmCross.Plugins.WebBrowser.PluginLoader

I just started using MVX, so hopefully I've provided enough to reproduce.
Summary:
Create a new solution with Ninja and select Json and WebBrowser plugins. When the WPF app is run, there will be an exception thrown in: WPF > App.xaml.cs > DoSetup > setup.initialize()
Note:
If only the Json plugin is added, this error doesn't occur.
Steps:
Open VS2013 (so no projects/solutions should be open)
Make sure Ninja coder plugin is installed using 3.2.0
Go to Tools > Ninja Coder... > Add Projects
On 'Build Options' screen, click Next
On Framework, click next
On Project Details, add project name 'MvxTest', click Next
On View Models, click Next
On Plugins, select 'Json' and 'WebBrowser'
On Nuget, select 'Newtonsoft Json'
Click Finish
Let everything get created
Set "MvxTest.WPF" as startup project
Start WPF project
Error:
An unhandled exception of type 'Cirrious.CrossCore.Exceptions.MvxException' occurred in Cirrious.CrossCore.dll
Additional information: could not load plugin assembly for type Cirrious.MvvmCross.Plugins.WebBrowser.PluginLoader
at Cirrious.CrossCore.Plugins.MvxFilePluginManager.LoadAssembly(Type toLoad)
at Cirrious.CrossCore.Plugins.MvxFilePluginManager.FindPlugin(Type toLoad)
at Cirrious.CrossCore.Plugins.MvxPluginManager.ExceptionWrappedLoadPlugin(Type toLoad)
at Cirrious.CrossCore.Plugins.MvxPluginManager.EnsurePlatformAdaptionLoadedT
at Cirrious.MvvmCross.Plugins.WebBrowser.PluginLoader.EnsureLoaded()
at Cirrious.CrossCore.Plugins.MvxPluginManager.EnsurePluginLoaded(IMvxPluginLoader pluginLoader)
at Cirrious.CrossCore.Plugins.MvxPluginManager.EnsurePluginLoaded(Type type)
at Cirrious.CrossCore.Plugins.MvxPluginManager.EnsurePluginLoadedTType
at Cirrious.CrossCore.Plugins.MvxPluginBootstrapAction1.Load(IMvxPluginManager manager) at Cirrious.CrossCore.Plugins.MvxPluginBootstrapAction1.RunAction()
at Cirrious.CrossCore.IoC.MvxSimpleIoCContainer.InternalSetResolver(Type tInterface, IResolver resolver)
at Cirrious.CrossCore.IoC.MvxSimpleIoCContainer.RegisterSingleton(Type tInterface, Object theObject)
at Cirrious.CrossCore.IoC.MvxSimpleIoCContainer.RegisterSingletonTInterface
at Cirrious.CrossCore.Mvx.RegisterSingletonTInterface
at Cirrious.MvvmCross.Platform.MvxSetup.InitializePluginFramework()
at Cirrious.MvvmCross.Platform.MvxSetup.InitializeSecondary()
at Cirrious.MvvmCross.Platform.MvxSetup.Initialize()
at MvxTest.Wpf.App.DoSetup() in c:\DEVn\MvxTest\MvxTest.Wpf\App.xaml.cs:line 32
at MvxTest.Wpf.App.OnActivated(EventArgs e) in c:\DEVn\MvxTest\MvxTest.Wpf\App.xaml.cs:line 48
at System.Windows.Application.WmActivateApp(Int32 wParam)
at System.Windows.Application.AppFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
As I understand it this plugin does not exist for WPF at all. It has nothing to do with Ninja. At least my attempt to add it to Droid projects adds the reference to files Cirrious.MvvmCross.Plugins.WebBrowser.dll and Cirrious.MvvmCross.Plugins.WebBrowser.Droid.dll but if I do the same it adds only Cirrious.MvvmCross.Plugins.WebBrowser.
That lead me to the conclusion that Cirrious.MvvmCross.Plugins.WebBrowser.Wpf does not exist at all and the table I found here (http://www.buildinsider.net/mobile/xamarintips/0053) confirms that.
Please correct me if I am wrong.
BR
Jan

MvvmCross - Error when loading ViewModel

I'm testing out MvvmCross in an existing Monotouch project.
I would like to start migrating the project to Mvvm in pieces.
I can start the application and it shows my first (mvvm) screen.
After that, i'm doing different (non mvvmcross) things (loading views etc) which I would like to port on a later moment.
I was now trying to port one of my views also to mvvmcross.
I created a View "public class TestView : MvxViewController" and a ViewModel "public class TestViewModel : MvxViewModel"
When loading that View, the app crashed with following error:
---Message:
Object reference not set to an instance of an object
---Stack Trace:
at Cirrious.MvvmCross.ViewModels.MvxViewModelLoader.LoadViewModel (Cirrious.MvvmCross.ViewModels.MvxViewModelRequest request, IMvxBundle savedState) [0x00000] in <filename unknown>:0
at Cirrious.MvvmCross.Touch.Views.MvxViewControllerExtensionMethods.LoadViewModel (IMvxTouchView touchView) [0x00000] in <filename unknown>:0
at Cirrious.MvvmCross.Touch.Views.MvxViewControllerExtensionMethods+<OnViewCreate>c__AnonStorey3.<>m__9 () [0x00000] in <filename unknown>:0
at Cirrious.MvvmCross.Views.MvxViewExtensionMethods.OnViewCreate (IMvxView view, System.Func`1 viewModelLoader) [0x00000] in <filename unknown>:0
at Cirrious.MvvmCross.Touch.Views.MvxViewControllerExtensionMethods.OnViewCreate (IMvxTouchView touchView) [0x00000] in <filename unknown>:0
at Cirrious.MvvmCross.Touch.Views.MvxViewControllerAdapter.HandleViewDidLoadCalled (System.Object sender, System.EventArgs e) [0x00000] in <filename unknown>:0
at (wrapper delegate-invoke) <Module>:invoke_void__this___object_EventArgs (object,System.EventArgs)
at Cirrious.CrossCore.Touch.Views.MvxDelegateExtensionMethods.Raise (System.EventHandler eventHandler, System.Object sender) [0x00000] in <filename unknown>:0
at Cirrious.CrossCore.Touch.Views.MvxEventSourceViewController.ViewDidLoad () [0x00000] in <filename unknown>:0
at CatalogMVVMTest.Touch.Views.TestView.ViewDidLoad () [0x0001a] in /Users/matthiasvalcke/Projects/MVVMDemos/CatalogMVVMTest/CatalogMVVMTest.Touch/Views/TestView.cs:20
...
It seems it crashes when calling "base.ViewDidLoad ();"
Not sure if this is important, but after loading the first view, I'm loading a new (non mvvmcross) view as root of the navigation stack.
So now I'm trying to load a MvvmCross View to a normal UIView(Controller)
I'm also getting following Mvx diagnostic output:
mvx: Diagnostic: 1.08 Request is null - assuming this is a TabBar type situation where ViewDidLoad is called during construction... patching the request now - but watch out for problems with virtual calls during construction
edit:
I'm also getting it if I just edit a simple sample from MvvmCross. For example, if I just take the basic sample with one "FirstView" and "FirstViewModel" and I do something like this, I'm getting the error:
var secondv = new SecondView ();
secondv.View.Frame = new RectangleF (0,250,320,100);
Add (secondv.View);
SecondView is just a MvxViewController. It seems like I can not add a View from a MvxViewController to another MvxViewController in code. Is this correct?
Anyone having an idea?
Ok, instead of doing this:
var secondv = new SecondView (); //(this is a MvxViewController
secondv.View.Frame = new RectangleF (0,250,320,100);
Add (secondv.View);
I had to do this (i found it in the tabbar sample):
var viewModel = new SecondViewModel ();
var secondv = this.CreateViewControllerFor(viewModel) as UIViewController;
secondv.View.Frame = new RectangleF (0,250,320,10);
secondv.View.AutoresizingMask = UIViewAutoresizing.None; //was needed because mvvm is enabling autostretch automatically?
Add (secondv.View);
Sorry for the questions, I'm using a lot of UIViewControllers on other UIViewControllers and it's difficult to understand the complete MvvmCross framework :-)
I'm still getting following diagnostic output, but no nullpointer anymore and it works:
mvx: Diagnostic: 0.11 Request is null - assuming this is a TabBar type situation where ViewDidLoad is called during construction... patching the request now - but watch out for problems with virtual calls during construction
Thanks for the help!
You are most likely hitting a bug in Xamarin's latest release.
This was addressed in https://github.com/slodge/MvvmCross/commit/5786d4964e4262cbf91661f04427e19648acf7df
Try upgrading to the mvvmcross 3.0.11-beta1 release or later - or roll back your xamarin version.
More info on http://forums.xamarin.com/discussion/comment/26049/#Comment_26049

What are my options to hunt Monotouch exceptions like "System.Exception: Selector invoked from objective-c on a managed object that has been GC'ed"?

I'm getting some of those exceptions below. What are my options to track those issues down? I'm kind of lost with those as they happen sporadically only and ONLY on the device but never in the Simulator.
System.Exception: Selector invoked from objective-c on a managed object that has been GC'ed ---> System.MissingMethodException: No constructor found for Browser.FolderListController::.ctor(System.IntPtr)
at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00000] in <filename unknown>:0
at System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) [0x00000] in <filename unknown>:0
at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in <filename unknown>:0
at MonoTouch.ObjCRuntime.Runtime.ConstructNSObject (IntPtr ptr, IntPtr klass) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at MonoTouch.ObjCRuntime.Runtime.ConstructNSObject (IntPtr ptr, IntPtr klass) [0x00000] in <filename unknown>:0
at MonoTouch.ObjCRuntime.Runtime.GetNSObject (IntPtr ptr) [0x00000] in <filename unknown>:0
at MonoTouch.ObjCRuntime.Runtime.GetNSObjectWrapped (IntPtr ptr) [0x00000] in <filename unknown>:0
at (wrapper native-to-managed) MonoTouch.ObjCRuntime.Runtime:GetNSObjectWrapped (intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00000] in <filename unknown>:0
at Browser.Application.Main (System.String[] args) [0x00000] in .../Main.cs:15
This isn't exactly related to the OP's situation, but I got this error when loading a view from a nib and it turned out I hadn't setup the view class's constructor properly:
public MyView() : base()
{
// Wrong!
}
You need to include the IntPtr parameter:
public MyView(IntPtr handle) : base(handle)
{
}
There's not a single, simple answer to that but I can share a way to help hunting them done:
Like #Miguel said such an exception means that the runtime is trying to re-surface an instance of Browser.FolderListController. That means that one, or many, instance(s) of Browser.FolderListController are being collected even if they will still be needed later.
Your first step should be to review the life cycle of every Browser.FolderListController instances. E.g.
where they are created;
where the calls occurs;
where you Dispose them manually - which can conflict with any retain'ing MonoTouch try to do to help your;
null'ed or removed from collections (i.e. removing references)...
Once you know the lifecycle you can:
add a finalizer to Browser.FolderListController and set a breakpoint inside it. The finalizer are executed on a separate thread so it won't tell you where the last reference was removed - but it will tell you approximately when (at least not before some point);
add the .ctor(IntPtr) constructor and add a breakpoint inside it. Again it won't give you an exact point (where it's being required) but it will tell you approximately when (at least not before another point);
Execute your application, get the crash and then look at what's going on between between those two points in time (compared to your lifecycle).
The above means that an object was created, passed down to Objective-C to be kept around and then it was garbage collected by Mono, and later re-surfaced to Mono on either a callback or some delegate invocation.
This usually means that in our code, we failed to catch a case where we needed to keep an explicit reference. A test case for this would be useful as it would help us fix this in MonoTouch.
We have also developed a new technique to eliminate all of these problems at once, but the code is not ready for public use.

IronPython Microsoft.Scripting Exception

I am trying to run IronPython code with c#.
I created a simple console application (.net 4) and added IronPython.dll , IronPython.Modules.dll and Microsoft.Scripting and wrote the next code -
using Microsoft.Scripting.Hosting;
namespace app
{
class Program
{
static void Main(string[] args)
{
ScriptRuntime runtime = IronPython.Hosting.Python.CreateRuntime();
ScriptEngine engine = runtime.GetEngine("py");
engine.Execute("print 'hello!'");
}
}
}
While trying to run this , I get an exception -
Unhandled Exception:
System.Reflection.TargetInvocationException:
Exception has been thrown by the
target of an invocation. --->
System.IO.FileNotFoundException :
Could not load file or assembly
'Microsoft.Scripting, Version=1.0.0.0,
Culture
=neutral, PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The syste m
cannot find the file specified. at
Core.LanguageProvider.Python..ctor(Stream
stream) --- End of inner exception
stack trace --- at
System.RuntimeMethodHandle._InvokeConstructor(IRuntimeMethodInfo
method, O bject[] args,
SignatureStruct& signature,
RuntimeType declaringType) at
System.RuntimeMethodHandle.InvokeConstructor(IRuntimeMethodInfo
method, Ob ject[] args,
SignatureStruct signature, RuntimeType
declaringType) at
System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags
invokeAttr, B inder binder, Object[]
parameters, CultureInfo culture) at
System.RuntimeType.CreateInstanceImpl(BindingFlags
bindingAttr, Binder bin der, Object[]
args, CultureInfo culture, Object[]
activationAttributes) at
System.Activator.CreateInstance(Type
type, BindingFlags bindingAttr, Binde
r binder, Object[] args, CultureInfo
culture, Object[]
activationAttributes) at
System.Activator.CreateInstance(Type
type, Object[] args) at
Core.LanguageRuntime.RegisterLanguageProvider(Type
providerType) in D:\cod
e\CodeRunner\Core\LanguageRuntime.cs:line
30 at Test.Program.Main(String[]
args) in
D:\code\CodeRunner\Test\Program.cs:lin
e 19 Press any key to continue . . .
I really , dont know what to do , searched at google and dont find a solution.
I will be glad to get help.
Whic version of iron python are you using ? The syntax you show seems belong to an older version, now you should have something like:
var ipy = Python.CreateRuntime();
anyway this blog post seems to be really accurate on pointing the correct reference to use. Anyway, ensure you have the latest IronPython version.