Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MvcSiteMapNodeAttributeDefinitionProvider GetTypesFromAssembly bug #318

Closed
adomass opened this issue Jun 2, 2014 · 0 comments
Closed

MvcSiteMapNodeAttributeDefinitionProvider GetTypesFromAssembly bug #318

adomass opened this issue Jun 2, 2014 · 0 comments

Comments

@adomass
Copy link

adomass commented Jun 2, 2014

    protected virtual IEnumerable<Type> GetTypesFromAssembly(Assembly assembly)
    {
        try
        {
            return assembly.GetTypes();
        }
        catch (ReflectionTypeLoadException ex)
        {
            return ex.Types;
        }
    }

should be changed to
try
{
return assembly.GetTypes();
}
catch (ReflectionTypeLoadException ex)
{
return e.Types.Where(t => t != null);
}

Otherwise e.Types returns some types as nulls and this causes nullreference exeption
Can use extension as we do in https://github.com/VirtoCommerce/vc-community/blob/dev/src/Core/CommerceFoundation/Frameworks/Extensions/AssemblyExtensions.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants