When I call CanExecute on a RelayCommand<T> with the parameter null, the behavior has changed going from 4.4.32 to 5.0.2.
I have decompiled the assemblies and write the results below. It is clear that the 4.4.32 code accepted null as an argument, whereas the 5.0.2 code does not.
This has broken our code in various places.
```
// Type: GalaSoft.MvvmLight.Command.RelayCommand`1
// Assembly: GalaSoft.MvvmLight, Version=4.4.32.16316, Culture=neutral, PublicKeyToken=6bdae7d54059775e
// MVID: 594A8629-B383-43DD-A41F-7AABF57F1F20
// Assembly location: D:\source\RhinoPlugins\obj\win64\packages\MvvmLightLibs.4.4.32.7\lib\net40\GalaSoft.MvvmLight.dll
public bool CanExecute(object parameter)
{
if (this._canExecute == null)
return true;
if (!this._canExecute.IsStatic && !this._canExecute.IsAlive)
return false;
if (parameter == null && typeof (T).IsValueType)
return this._canExecute.Execute(default (T));
else
return this._canExecute.Execute((T) parameter);
}
// Type: GalaSoft.MvvmLight.Command.RelayCommand`1
// Assembly: GalaSoft.MvvmLight, Version=5.0.2.32240, Culture=neutral, PublicKeyToken=0e453835af4ee6ce
// MVID: 589788DB-9532-473D-82DB-8D64C2AA450B
// Assembly location: D:\source\RhinoPlugins\obj\win64\packages\MvvmLightLibs.5.0.2.0\lib\net40\GalaSoft.MvvmLight.dll
public bool CanExecute(object parameter)
{
if (this._canExecute == null)
return true;
if (this._canExecute.IsStatic || this._canExecute.IsAlive)
{
if (parameter == null && typeof (T).IsValueType)
return this._canExecute.Execute(default (T));
if (parameter is T)
return this._canExecute.Execute((T) parameter);
}
return false;
}
```
I have decompiled the assemblies and write the results below. It is clear that the 4.4.32 code accepted null as an argument, whereas the 5.0.2 code does not.
This has broken our code in various places.
```
// Type: GalaSoft.MvvmLight.Command.RelayCommand`1
// Assembly: GalaSoft.MvvmLight, Version=4.4.32.16316, Culture=neutral, PublicKeyToken=6bdae7d54059775e
// MVID: 594A8629-B383-43DD-A41F-7AABF57F1F20
// Assembly location: D:\source\RhinoPlugins\obj\win64\packages\MvvmLightLibs.4.4.32.7\lib\net40\GalaSoft.MvvmLight.dll
public bool CanExecute(object parameter)
{
if (this._canExecute == null)
return true;
if (!this._canExecute.IsStatic && !this._canExecute.IsAlive)
return false;
if (parameter == null && typeof (T).IsValueType)
return this._canExecute.Execute(default (T));
else
return this._canExecute.Execute((T) parameter);
}
// Type: GalaSoft.MvvmLight.Command.RelayCommand`1
// Assembly: GalaSoft.MvvmLight, Version=5.0.2.32240, Culture=neutral, PublicKeyToken=0e453835af4ee6ce
// MVID: 589788DB-9532-473D-82DB-8D64C2AA450B
// Assembly location: D:\source\RhinoPlugins\obj\win64\packages\MvvmLightLibs.5.0.2.0\lib\net40\GalaSoft.MvvmLight.dll
public bool CanExecute(object parameter)
{
if (this._canExecute == null)
return true;
if (this._canExecute.IsStatic || this._canExecute.IsAlive)
{
if (parameter == null && typeof (T).IsValueType)
return this._canExecute.Execute(default (T));
if (parameter is T)
return this._canExecute.Execute((T) parameter);
}
return false;
}
```