New SMF not compatible with Microsoft.Bcl.Async Nuget package

Nov 18, 2012 at 11:42 PM
Edited Nov 19, 2012 at 2:13 AM

!! Edit: The problem appears to be a combination of the BCL extensions for async and the Extras DLL that comes with MVVM lite... removing either/or fixes the problem. 

 

Hey guys,

I'm having an issue in my project. The SMF player will not play anything when I have Microsoft.Blc.Async Nuget package installed (1.0.12-beta (prerelease)). 

The player controls etc load, but nothing will play. 

I get an exception in output: An exception of type 'System.Reflection.ReflectionTypeLoadException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary.

To replicate, create a new project, phone 7, add the libs for SMF, create a basic player with buck bunny or something. Test that it works.

Add the bcl async package with nuget, retry the test - fails.

Any suggestions?

Cheers,

Jordan.

Nov 18, 2012 at 11:47 PM

Oh I should mention, I'm using VS2012, as there are shared projects between WP7 and WP8 projects. 

Apr 28, 2013 at 1:50 AM
I'm currently facing this issue - and I can't remove Bcl.Async (not without a complete rewrite!)

Is there a workaround / fix?
Apr 29, 2013 at 10:57 AM
I just ran into what may be the same issue on another project. I only had references to Bcl.Async in some of the libraries used by the application. However, only some of the Bcl.Async DLLs made it to the .xap. Adding the Bcl.Async NuGet package to the application itself got bipbopall.m3u8 "Bip-Bop"ing instead of throwing FileNotFound exceptions. The relevant .csproj files can be found in here: https://phonesm.codeplex.com/releases/view/105853. Note that the .csproj files have a manual edit to help the package restore, but I don't think that would be related (I added a Condition="Exists('...')" for the Bcl.Build.targets import to allow the projects to load when the package is not present).
Coordinator
Apr 29, 2013 at 5:09 PM
Hello, I have a few quick questions to better diagnose the issue. Are you using VS2010 or VS2012? Also, are you running the new Async Bcl release or the RC version?
Coordinator
Apr 29, 2013 at 5:18 PM
Also, I suspect that there is a specific assembly included in the Async BCL libs that is failing to load via MEF and is causing the issue you are seeing.

In case this helps, you can try calling something like:
PluginsManager.AssembliesToExclude.Add("System.");
PluginsManager.AssembliesToExclude.Add("Microsoft.");
This will exclude all assemblies that start with the strings above from being considered when looking for MEF plugins. You might need to play with the string added to the collection to make sure you exclude the right assemblies.
Apr 30, 2013 at 12:29 AM
Edited Apr 30, 2013 at 3:44 PM
The Bcl.Async DLL that didn't get included in the .xap was Microsoft.Threading.Tasks.Extensions.Phone.dll (rename the .xap to .zip and look inside). Furthermore, this was only a problem when the Bcl.Async-dependent assembly was included by referencing the DLL directly. Having a reference to the project did not cause this problem.

I didn't mention this above, but the project is a WP7 (targeting 7.1) SMF 2.7 player relying on some other libraries that use Bcl.Async. This works with the current Bcl.Async (1.0.19) and has worked with the pre-release Bcl.Async packages.
Apr 30, 2013 at 1:21 AM
Hey all - Tim is correct here, it was a problem with MEF and dynamic loading assemblies (apologies I cannot remember the exact issue/resolution).
Jul 13, 2013 at 5:48 AM
Edited Jul 13, 2013 at 5:50 AM
Is there any more news on this? - I am tearing my hair out trying to get a resolution on this.

I have installed the latest of both Bcl.Async and SMF; I've also added the calls noted by Tim above to my app.xaml.cs - and I still have the same issue.

Can I or anyone provide ANY information to help?

The App was originally built in VS2010 - but is now a VS2012 solution. The app targets WP7.1
Jul 13, 2013 at 9:52 PM
Hey there,

Apologies - I'm replying from my phone email and cannot see the thread.

If i remember the problem was that the WP toolkit wasn't referenced from all projects (or something similar). It was to do with MEF i think. Apologies for the vagueness!

Jordan.

Sep 6, 2013 at 10:27 AM
timgreenfield wrote:
Also, I suspect that there is a specific assembly included in the Async BCL libs that is failing to load via MEF and is causing the issue you are seeing.

In case this helps, you can try calling something like:
PluginsManager.AssembliesToExclude.Add("System.");
PluginsManager.AssembliesToExclude.Add("Microsoft.");
This will exclude all assemblies that start with the strings above from being considered when looking for MEF plugins. You might need to play with the string added to the collection to make sure you exclude the right assemblies.
I was having this same issue. To this day I'm not sure what DLL was causing the problem, but after adding everything from Caliburn.Micro to Telerik's components to excluded list, things started working. Thanks for the tip.