CMContrib icon indicating copy to clipboard operation
CMContrib copied to clipboard

'System.MissingMethodException' occured when runs on CM v1.5.2

Open jkp74 opened this issue 11 years ago • 0 comments

While i know that CMContrib runs officially with CM v 1.4.1, I went ahead to run CMContrib on CM v 1.5.2 Everything works fine until i call yield return q.AsResult():

public IEnumerable<IResult> TestRun2()
{

   var q = new Question("Isn't this a nice way to create a Dialog Window?",
                                        Answer.Yes,
                                        Answer.No);

   yield return q.AsResult();
}

At Line 44 of DialogResult.cs

Micro.Execute.OnUIThread(() => IoC.Get<IWindowManager>().ShowDialog(vm, viewContext)); ; throws an exception

Error Message: A first chance exception of type 'System.MissingMethodException' occurred in Caliburn.Micro.dll

The exception happens in INPC.cs (from CM) - after action() - Line 156

public static void OnUIThread(this System.Action action) {
            if (executor != null)
                executor(action);
            else if (CheckAccess())
                action();                    // <--- Line 156 - this is where the exception starts.
            else

Stack Trace:

Message: "Method not found: '!!0 Caliburn.Micro.IoC.Get()'."

StackTrace " at Caliburn.Micro.Contrib.Results.DialogResult1.<>c__DisplayClass5.<Execute>b__3()\r\n at Caliburn.Micro.Execute.OnUIThread(Action action) in c:\\Users\\Rob\\Documents\\CodePlex\\caliburnmicro\\src\\Caliburn.Micro.Silverlight\\INPC.cs:line 156\r\n at Caliburn.Micro.Contrib.Results.DialogResult1.Execute(ActionExecutionContext context) in D:\dev\dotNET\projects\CMContrib\src\CMContrib.SL\Results\DialogResult.cs:line 44\r\n at Caliburn.Micro.SequentialResult.ChildCompleted(Object sender, ResultCompletionEventArgs args) in c:\Users\Rob\Documents\CodePlex\caliburnmicro\src\Caliburn.Micro.Silverlight\SequentialResult.cs:line 59"

I have included these lines in the bootstrapper:

        protected override IEnumerable<Assembly> SelectAssemblies()
        {
            return base.SelectAssemblies().Concat(new Assembly[] { typeof(ResultExtensions).Assembly });
        }

I hope there is a quick fix for this.

jkp74 avatar Nov 08 '13 01:11 jkp74