martasp / BlazorLiveReload

BlazorLiveReload
143 stars 14 forks source link

{"An item with the same key has already been added. Key: /Index.razor"} #21

Open Levvy055 opened 3 years ago

Levvy055 commented 3 years ago

When starting Blazor Server-based project got following error with stacktrace:

   at System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException[T](T key)
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at RazorComponentsPreview.TestRazorProjectFileSystem.Add(RazorProjectItem item)
   at RazorComponentsPreview.Generator.Add(String filePath, String content)
   at RazorComponentsPreview.RuntimeComponentsGenerator..ctor(IServiceCollection serviceCollection)
   at RazorComponentsPreview.RazorRuntimeCompilationExtensions.UseRazorComponentsRuntimeCompilation(IApplicationBuilder app)
   at Tori.Web.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment env, DbContextOptions`1 identityDbContextOptions, IOptions`1 operationalStoreOptions, UserManager`1 userManager, RoleManager`1 roleManager) in S:\Kod\W\Blazor.Web\Startup.cs:line 86
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass15_0.<UseStartup>b__1(IApplicationBuilder app)
   at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Server.IIS.Core.IISServerSetupFilter.<>c__DisplayClass2_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.<StartAsync>d__31.MoveNext()
ennerperez commented 2 years ago

Multiples files with same name in different folders, the build index using file name instead some kind of unique identifier.