HelloScreens NullReferenceException

Topics: Framework Services, UI Architecture
Aug 16, 2011 at 5:24 PM

Hi All,

I'm brand new to Caliburn Micro, I have downloaded the latest source code(1f6100f2f0af).
I'm being reading the documention and going through all the samples.
This is a great and powerful framework.

I'm going through the HelloScreens sample, and I'm running into a
NullReferenceException Exception when going through the following steps:

start app
Click on Customers
Click on New to create new "Customer 1"
Click on Close but don't answer message box question
Click on Customers
Click on New to create new "Customer 2"
Click on Close
Click on Yes on Message box
Click on "Customer 1"
Click on Yes on the message Box
this causes a NullReferenceException in

DefaultCloseStrategy.cs file

void Evaluate(bool result, IEnumerator<T> enumerator, Action<bool, IEnumerable<T>> callback)
{
    finalResult = finalResult && result;

    if (!enumerator.MoveNext())
    {
        callback(finalResult, closeConductedItemsWhenConductorCannotClose ? closable : new List<T>());
        closable = null;
    }
    else
    {
        var current = enumerator.Current;
        var guard = current as IGuardClose;
        if (guard != null)
        {
            guard.CanClose(canClose =>{
                if(canClose)
                    closable.Add(current);  <==== This line is causing the exception because closable is null

                Evaluate(canClose, enumerator, callback);
            });
        }
        else
        {
            closable.Add(current);
            Evaluate(true, enumerator, callback);
        }
    }
}

Can someone shed some light on how to fix this?

Many thanks

Luigi

Aug 18, 2011 at 5:24 AM
Edited Aug 18, 2011 at 5:26 AM

Hi,

Sorry to keep asking.

I would like to use the HelloScreens UI Pattern, but I can't figure out what should be changed to avoid this issue.

Does anyone have any comments or ideas on it?

Thank You

Luigi