Permalink
Browse files

Update MEF example for 3.0.2 change.

1 parent fbd27be commit 23e8a6d23a8885312c76bb145cf7c3028a1d0b4f @nigel-sampson nigel-sampson committed on GitHub Dec 6, 2016
Showing with 4 additions and 0 deletions.
  1. +4 −0 samples/Caliburn.Micro.HelloMef/Caliburn.Micro.HelloMef/MefBootstrapper.cs
@@ -36,6 +36,10 @@ protected override void Configure()
protected override object GetInstance(Type serviceType, string key)
{
+ // Skip trying to instantiate views since MEF will throw an exception
+ if (typeof(UIElement).IsAssignableFrom(serviceType))
+ return null;
+
var contract = string.IsNullOrEmpty(key) ? AttributedModelServices.GetContractName(serviceType) : key;
var exports = container.GetExportedValues<object>(contract);

0 comments on commit 23e8a6d

Please sign in to comment.