Silverlight 5?

Oct 13, 2011 at 3:49 PM

I am using Silverlight 5 beta and I cannot get design data to show up. Has anyone used MEFedMVVM with Silverlight 5?

Coordinator
Oct 16, 2011 at 9:04 AM

did not try it yet... what is the error? I wouldn't see why it would not work 

Nov 17, 2011 at 11:59 AM
Edited Nov 17, 2011 at 1:56 PM

I tried some time ago and found out that it the design time support does not seems to work with silverlight 5 (beta/RC) so I posted my stacktrace here: http://forums.silverlight.net/t/239857.aspx/1?I+am+using+MEFedMVVM+for+my+silverlight+project+but+the+design+time+features+don+t+work+correctly

Jan 5, 2012 at 10:44 PM

I think you need to recompile asseblies, because of new runtime version.

I'll try tomorrow.

Jan 6, 2012 at 2:48 PM

I did recompile the MEFedMVVM assemblies for SL5 (and in the process removed the blend SDK reference) with no success, but try it yourself too and let us hear how it goes.

I have posted a new issue at https://connect.microsoft.com/VisualStudio/feedback/details/716044/mef-linq-exception-in-designer-when-silverlight-5-developer-runtime-is-installed where I also did post the modified MEFedMVVM source code for SL5, please vote for it too.

Jan 10, 2012 at 4:13 PM

Recompilation works great at runtime but designtime doesn't work for SL5.

And my refactored version (where I've moved services implementation to separate Services assembly and DelegateCommand and NotifyPropertyChangedBase I've moved to ValidationExtensions) works at runtime. Whereas at designtime neither WPF nor Silverlight does work.

Jan 13, 2012 at 4:02 PM

In a simple SL5 project, the current NuGet package worked - but in my super complicated SL5 project (which I just upgraded), it won't properly import the viewmodel and assign it as the datacontext. 

My solution was to build source code in SL5 and everything works now. A common naming theme I've been seeing is MEFedMVVM.SL5.dll etc.

@Marlon it'd be great if this could be a part of the NuGet package.

Jan 13, 2012 at 8:44 PM

I that case there should be added another conditional compilation symbol because of presense of DataContextChanged event in SL5

And Windows Phone version would be great.

Jan 15, 2012 at 11:57 AM
duluca wrote:

In a simple SL5 project, the current NuGet package worked - but in my super complicated SL5 project (which I just upgraded), it won't properly import the viewmodel and assign it as the datacontext. 


Did you get the designtime features to work or only the runtime?
If you did get it to work had you installed the VS 11 preview on your computer?

Jan 17, 2012 at 2:19 PM

I haven't installed VS11 preview at all on this machine.

As far as I can I tell only runtime works, but then again I don't spend too much time with design time features. It just seems faster to hit F5 and see if it works or not. And just to put it out there again, without compiling for SL5, runtime wouldn't work.

Jan 27, 2012 at 3:48 PM
Edited Jan 28, 2012 at 2:16 PM

All works well in Silverlight 5.

Feb 1, 2012 at 4:31 PM
joshuadavidlee wrote:

All works well in Silverlight 5.

You get the design-time features working as well?

Feb 1, 2012 at 5:48 PM

Oh sorry didn't test that because SL5 comes with that basic functionality now.  But evrything else is working great.

Feb 1, 2012 at 6:48 PM

So I attached a debugger to Visual Studio to see why the design time support wasnt working, and this is the exception that I caught.

 

MEFedMVVM Composition Container is changing.
Error while resolving ViewModel. System.MissingMethodException: Method not found: 'System.Delegate System.Reflection.MethodInfo.CreateDelegate(System.Type, System.Object)'.
   at System.Dynamic.Utils.TypeExtensions.CreateDelegate(MethodInfo methodInfo, Type delegateType, Object target)
   at System.Linq.Expressions.Compiler.LambdaCompiler.CreateDelegate()
   at System.Linq.Expressions.Compiler.LambdaCompiler.Compile(LambdaExpression lambda, DebugInfoGenerator debugInfoGenerator)
   at System.Linq.Expressions.Expression`1.Compile()
   at System.Linq.EnumerableQuery`1.GetEnumerator()
   at System.Linq.EnumerableQuery`1.System.Collections.Generic.IEnumerable.GetEnumerator()
   at System.ComponentModel.Composition.Primitives.ComposablePartCatalog.GetExports(ImportDefinition definition)
   at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
   at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
   at MEFedMVVM.ViewModelLocator.MEFedMVVMExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition) in C:\Development\External Libs\MEFedMVVM\MEFedMVVMDemo\MEFedMVVM\ViewModelLocator\MEFedMVVMExportProvider.cs:line 37
   at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
   at System.ComponentModel.Composition.Hosting.AggregateExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
   at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExports(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
   at System.ComponentModel.Composition.Hosting.CompositionContainer.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
   at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition)
   at MEFedMVVM.ViewModelLocator.MEFedMVVMResolver.GetViewModelByContract(String vmContractName, Object contextToInject, CreationPolicy policy) in C:\Development\External Libs\MEFedMVVM\MEFedMVVMDemo\MEFedMVVM\ViewModelLocator\MEFedMVVMResolver.cs:line 60
   at MEFedMVVM.ViewModelLocator.ViewModelRepository.AttachViewModelToView(String vmContract, FrameworkElement view, CreationPolicy policy) in C:\Development\External Libs\MEFedMVVM\MEFedMVVMDemo\MEFedMVVM.WPF\ViewModelLocator\ViewModelRepoitory.cs:line 88
   at MEFedMVVM.ViewModelLocator.ViewModelLocator.AttachViewModel(FrameworkElement element, String vmContractName, CreationPolicy policy) in C:\Development\External Libs\MEFedMVVM\MEFedMVVMDemo\MEFedMVVM.WPF\ViewModelLocator\ViewModelLocator.cs:line 145
System.Windows.Data Error: 40 : BindingExpression path error: 'PropertyEntry' property not found on 'object' ''ModelPropertyEntry' (HashCode=65420)'. BindingExpression:Path=PropertyEntry.PropertyValue.ParentProperty.IsReadOnly; DataItem='ModelPropertyEntry' (HashCode=65420); target element is 'PropertyMarker' (Name='PART_PropertyMarker'); target property is 'IsEnabled' (type 'Boolean')
System.Windows.Data Error: 40 : BindingExpression path error: 'PropertyEntry' property not found on 'object' ''ModelPropertyEntry' (HashCode=65420)'. BindingExpression:Path=PropertyEntry.PropertyValue; DataItem='ModelPropertyEntry' (HashCode=65420); target element is 'VisibleTextBlock' (Name='PART_NameArea'); target property is 'FontWeight' (type 'FontWeight')
System.Windows.Data Error: 40 : BindingExpression path error: 'PropertyEntry' property not found on 'object' ''ModelPropertyEntry' (HashCode=17182519)'. BindingExpression:Path=PropertyEntry.PropertyValue.ParentProperty.IsReadOnly; DataItem='ModelPropertyEntry' (HashCode=17182519); target element is 'PropertyMarker' (Name='PART_PropertyMarker'); target property is 'IsEnabled' (type 'Boolean')
System.Windows.Data Error: 40 : BindingExpression path error: 'PropertyEntry' property not found on 'object' ''ModelPropertyEntry' (HashCode=17182519)'. BindingExpression:Path=PropertyEntry.PropertyValue; DataItem='ModelPropertyEntry' (HashCode=17182519); target element is 'VisibleTextBlock' (Name='PART_NameArea'); target property is 'FontWeight' (type 'FontWeight')

Feb 1, 2012 at 11:34 PM

As I understand the problem is caused by IQueryable


Feb 1, 2012 at 11:53 PM

So the problem is

            var exports = _exportProvider.GetExports(definitionatomicComposition);
Parts = '(new System.ComponentModel.Composition.Primitives.ComposablePartCatalogDebuggerProxy(_exportProvider.Catalog)).Parts' threw an exception of type 'System.MissingMethodException'
Feb 2, 2012 at 5:22 PM
Edited Feb 2, 2012 at 5:26 PM
xperiandri wrote:

So the problem is

            var exports = _exportProvider.GetExports(definitionatomicComposition);


Correct, or at least that is the line of code in MEFedMVVM that result in the exception.
However it looks like this really is a problem in the designer version of LINQ/Lambdas, possible because they run it with different privilieges or with the wrong mix of assemblies compared to when the application is run in the browser/OOB.

I haven't seen any response from microsoft from the issue on the connect website so vote for it there (link can be found at the start of the conversation) and mark it as reproducable, or even better if you have some contact person who you can get in touch with.

Jun 10, 2012 at 4:03 PM

According to https://connect.microsoft.com/VisualStudio/feedback/details/716044/mef-linq-exception-in-designer-when-silverlight-5-developer-runtime-is-installed all you need is to install the .NET framework 4.5 in order to get MEFedMVVM to work in the designer.

I have tried with both the Beta and RC of .NET, but then togheter with VS 11/2012, and it works!