!785 fix(#I2A3PX): multiple tab mode in layout throw exception

* fix: 修复 wasm 模式无法获取 GetEntryAssembly() 程序集问题
This commit is contained in:
Argo 2020-12-21 00:09:36 +08:00
parent b4f5e69039
commit b6ca852b87

View File

@ -207,8 +207,9 @@ namespace BootstrapBlazor.Components
private Task InitRouteTable() => Task.Run(() =>
{
var apps = AdditionalAssemblies == null ? new[] { Assembly.GetEntryAssembly()! } : new[] { Assembly.GetEntryAssembly()! }.Concat(AdditionalAssemblies);
var componentTypes = apps.SelectMany(a => a.ExportedTypes.Where(t => typeof(IComponent).IsAssignableFrom(t)));
var apps = AdditionalAssemblies == null ? new[] { Assembly.GetEntryAssembly() } : new[] { Assembly.GetEntryAssembly() }.Concat(AdditionalAssemblies).Where(a => a != null);
var componentTypes = apps.SelectMany(a => a!.ExportedTypes.Where(t => typeof(IComponent).IsAssignableFrom(t)));
foreach (var componentType in componentTypes)
{
var routeAttributes = componentType.GetCustomAttributes<RouteAttribute>(false);