1

Closed

NullReferenceException in ProviderFinder

description

Hi Throb,
 
I have a NullReferenceException in the initialization of the Assemblies array with Silverlight :
 
    static Assembly[] _Assemblies =
        System.Windows.Deployment.Current.Parts
            .Select(p => new Uri(p.Source, UriKind.Relative))
            .Concat(System.Windows.Deployment.Current.ExternalParts.Select(ep => ep.Source))
            .Select(uri => System.Windows.Application.GetResourceStream(uri))
            .Select(strInfo => new System.Windows.AssemblyPart().Load(strInfo.Stream))
            .ToArray()
 
When System.Windows.Application.GetResourceStream(uri)) return null.
 
I have fix with this trick :
 
    static Assembly[] _Assemblies =
        System.Windows.Deployment.Current.Parts
            .Select(p => new Uri(p.Source, UriKind.Relative))
            .Concat(System.Windows.Deployment.Current.ExternalParts.Select(ep => ep.Source))
            .Select(uri => System.Windows.Application.GetResourceStream(uri))
            .Select(strInfo => strInfo == null ? null : new System.Windows.AssemblyPart().Load(strInfo.Stream))
            .Where(assembly => assembly != null)
            .ToArray()
 
Thanks.
Closed Aug 13, 2011 at 2:03 PM by Throb

comments

wrote Aug 13, 2011 at 2:03 PM

Resolved with changeset 61362.

Throb wrote Aug 13, 2011 at 2:28 PM

Ok.. Applied your suggestion.. Tx :-)

wrote Feb 14, 2013 at 1:41 AM

wrote May 16, 2013 at 4:55 AM