This project has moved. For the latest updates, please go here.
1

Closed

Exception in IsInDesignModeNet() in WP8 app

description

Just a minor issue, when using the PCL version of MvvmLight 5.0.2.0 in WP8 app, the ViewModelBase.IsInDesignModeStatic getter throws inner ArgumentNullException. For people with OCD, that don't like Exception logs in the Output windows this could be an issue :)

Problem is in ViewModelBase.cs, line 207 and it can be fixed like this:
// now
var dmp = dm.GetTypeInfo().GetDeclaredField("IsInDesignModeProperty").GetValue(null);

// fixed
if (dm == null) return false;
var dmp = dm.GetTypeInfo().GetDeclaredField("IsInDesignModeProperty").GetValue(null);
This is probably not the only place where similar exception could happen in this file. It's also better performance-wise to handle these errors manually and not using one big try/catch statement.
Closed Feb 15, 2015 at 5:14 PM by lbugnion

comments

lbugnion wrote Feb 6, 2015 at 6:06 PM

Fixed in V5.1 (upcoming)