{"action":"created","issue":{"url":"https://api.github.com/repos/MvvmCross/MvvmCross/issues/1132","labels_url":"https://api.github.com/repos/MvvmCross/MvvmCross/issues/1132/labels{/name}","comments_url":"https://api.github.com/repos/MvvmCross/MvvmCross/issues/1132/comments","events_url":"https://api.github.com/repos/MvvmCross/MvvmCross/issues/1132/events","html_url":"https://github.com/MvvmCross/MvvmCross/issues/1132","id":106296781,"number":1132,"title":"Calling Init() on ViewModel creates exception without parameters","user":{"login":"indazoo","id":7868519,"avatar_url":"https://avatars.githubusercontent.com/u/7868519?v=3","gravatar_id":"","url":"https://api.github.com/users/indazoo","html_url":"https://github.com/indazoo","followers_url":"https://api.github.com/users/indazoo/followers","following_url":"https://api.github.com/users/indazoo/following{/other_user}","gists_url":"https://api.github.com/users/indazoo/gists{/gist_id}","starred_url":"https://api.github.com/users/indazoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indazoo/subscriptions","organizations_url":"https://api.github.com/users/indazoo/orgs","repos_url":"https://api.github.com/users/indazoo/repos","events_url":"https://api.github.com/users/indazoo/events{/privacy}","received_events_url":"https://api.github.com/users/indazoo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-14T08:44:37Z","updated_at":"2015-09-17T11:56:23Z","closed_at":null,"body":"Hi\r\n\r\nI found a small bug(?) in Cirrious.MvvmCross.ViewModels.CallBundleMethod().\r\nIf the parameter \"bundle\" is null, then CallBundleMethod(...) fails. This creates problems for me because this case occurs when I try to use design time data in Visual Studio. The error does not occur at runtime.\r\nI'm not very familiar with the inner MVVMcross source code and do not really know at what place the check should be done. But with an additional line to check for bundle == null, the Designer no longer throws an exception.\r\nMaybe the check should be much earlier in the stack because if there is no bundle there is no need to run CallBundleMethod and it should fail (don't no your coding style). Maybe there should be a IsDesigner check earlier? I found no way to intercept/override a method to do a designer check in my code after Start().\r\n\r\nAnyway, that helped:\r\npublic static void CallBundleMethod(this IMvxViewModel viewModel, MethodInfo methodInfo, IMvxBundle bundle)\r\n        {\r\n\t\t\tif (bundle == null) return;  //!!!! new line , DesignMode in Visual Studio needs this check\r\n                        var parameters = methodInfo.GetParameters().ToArray(); \r\n\r\n\r\n\r\nI created a small visual studio project with latest MvvmCross code (a few days old):\r\nhttps://github.com/indazoo/MvvmCross_DesignData/commits/master\r\nThere are two commits of today. The earlier one throws an Exception in Designer.\r\n\r\nYour help would be greatly appreciated.\r\n\r\nP.S. There is some confusion on my side about windows.Common and Windows Store and when to use what. The samples on the net and your fast progress with the renaming/moving (lately the plugins) produce a steep learning curve on my side. Maybe I miss something."},"comment":{"url":"https://api.github.com/repos/MvvmCross/MvvmCross/issues/comments/141054370","html_url":"https://github.com/MvvmCross/MvvmCross/issues/1132#issuecomment-141054370","issue_url":"https://api.github.com/repos/MvvmCross/MvvmCross/issues/1132","id":141054370,"user":{"login":"indazoo","id":7868519,"avatar_url":"https://avatars.githubusercontent.com/u/7868519?v=3","gravatar_id":"","url":"https://api.github.com/users/indazoo","html_url":"https://github.com/indazoo","followers_url":"https://api.github.com/users/indazoo/followers","following_url":"https://api.github.com/users/indazoo/following{/other_user}","gists_url":"https://api.github.com/users/indazoo/gists{/gist_id}","starred_url":"https://api.github.com/users/indazoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indazoo/subscriptions","organizations_url":"https://api.github.com/users/indazoo/orgs","repos_url":"https://api.github.com/users/indazoo/repos","events_url":"https://api.github.com/users/indazoo/events{/privacy}","received_events_url":"https://api.github.com/users/indazoo/received_events","type":"User","site_admin":false},"created_at":"2015-09-17T11:56:23Z","updated_at":"2015-09-17T11:56:23Z","body":"Thanks for your response,\r\nI would, but I do not have a clue how you want to have the detecting of the different Designers implemented in your code. For me it was easy. I have a small static method (App2.Helpers.DesignTime.IsInDesignMode) in my code. Your code is highly modularized and I have no idea if it is mandatory to use some classes like MvxDesignTimeHelper, or to be honest how to implement correctly with your IOC stuff and then the mother of all questions : Where? This is not criticism, you guys are just miles ahead of me and I just started using MvvmCross. You know exactly where this stuff belongs.\r\nAnd, after my contributions in other projects being rejected by things like \"we don't like your formatting of your comments\" I'm a bit \"contribute shy\" ! So I posted the code to help. If you think no one else uses that just close the issue, its ok for me. If you think it is needed put it on low fire for the rainy/cold winter."}}