BuildSiteMap() can't load types

Sep 18, 2010 at 5:17 PM

Hello,

I found a problem when I use Mvc SiteMap Provider with Framework 4.0 and a custom authorize attribute.

It seems that .NET framework generate a dynamic assembly

When DefaultSiteMapProvider run BuildSiteMap(), I have an exception, because I couldn't load dynamic types

I have changed the code with :

 var assemblies = AppDomain.CurrentDomain.GetAssemblies()
                            .Where(a => !a.FullName.StartsWith("mscorlib")
                                        && !a.FullName.StartsWith("System")
                                        && !a.FullName.StartsWith("Microsoft")
                                        && !a.FullName.StartsWith("WebDev")
                                        && !a.FullName.StartsWith("SMDiagnostics")
                                        && !a.FullName.StartsWith("Anonymously")
                                        && !a.FullName.StartsWith("App_")
                                        && !skipAssemblyScanOn.Contains(a.GetName().Name));

  foreach (Assembly assembly in assemblies)
  {
      if (!assembly.IsDynamic) {
         ProcessNodesInAssembly(assembly);
      }
   }

Now it works correctly

Thx

 

Coordinator
Sep 21, 2010 at 9:57 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.