Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Hot reload error: System.AggregateException: One or more errors occurred. (Format of the executable (.exe) or library (.dll) is invalid.) #122628

@Atulin

Description

@Atulin

Description

I'm running my Aspire-based project with dotnet watch run --project "./Ogma3.AppHost/Ogma3.AppHost.csproj". Hot reload works.

Eventually, though, it randomly throws the forementioned error after a file change, and from that point on it stops working completely. The application itself does not crash, it just doesn't hot reload anymore.

Reproduction Steps

I tried recreating this issue with a simple project, but failed. It could very well be a function of complexity.

Expected behavior

dotnet watch ⌚ File updated: F:\VS Projects\Ogma3\Ogma3\Pages\Index.cshtml
dotnet watch 🔥 [Ogma3.AppHost (net10.0)] Hot reload succeeded.

Actual behavior

dotnet watch ⌚ File updated: F:\VS Projects\Ogma3\Ogma3\Pages\Index.cshtml
dotnet watch 🔥 [Ogma3.AppHost (net10.0)] Hot reload succeeded.
dotnet watch ⚠ [Ogma3 (net10.0)] Exception from 'Microsoft.AspNetCore.Mvc.HotReload.HotReloadService.UpdateApplication': System.AggregateException: One or more errors occurred. (Format of the executable (.exe) or library (.dll) is invalid.)
 ---> System.BadImageFormatException: Format of the executable (.exe) or library (.dll) is invalid.
   at System.Reflection.Metadata.RuntimeTypeMetadataUpdateHandler.IsMetadataUpdateDeleted(RuntimeModule module, Int32 memberToken)
   at System.RuntimeType.RuntimeTypeCache.MemberInfoCache`1.PopulateConstructors(Filter filter)
   at System.RuntimeType.RuntimeTypeCache.MemberInfoCache`1.GetListByName(String name, Span`1 utf8Name, MemberListType listType, CacheType cacheType)
   at System.RuntimeType.RuntimeTypeCache.MemberInfoCache`1.Populate(String name, MemberListType listType, CacheType cacheType)
   at Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultBindingMetadataProvider.CreateBindingMetadata(BindingMetadataProviderContext context)
   at Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultCompositeMetadataDetailsProvider.CreateBindingMetadata(BindingMetadataProviderContext context)
   at Microsoft.AspNetCore.Mvc.ModelBinding.BindingInfo.TryApplyBindingInfo(ModelMetadata modelMetadata)
   at Microsoft.AspNetCore.Mvc.ModelBinding.BindingInfo.GetBindingInfo(IEnumerable`1 attributes, ModelMetadata modelMetadata)
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.CompiledPageActionDescriptorFactory.CreateCompiledDescriptor(PageActionDescriptor actionDescriptor, CompiledViewDescriptor viewDescriptor)
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.CompiledPageActionDescriptorProvider.OnProvidersExecuting(ActionDescriptorProviderContext context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.UpdateCollection()
   at Microsoft.Extensions.Primitives.ChangeToken.ChangeTokenRegistration`1.OnChangeTokenFired()
   at System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(Boolean throwOnFirstException)
   --- End of inner exception stack trace ---
   at System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(Boolean throwOnFirstException)
   at Microsoft.DotNet.HotReload.MetadataUpdateHandlerInvoker.<>c__DisplayClass19_0.<GetUpdateHandlerActions>b__6(Type[] types)
dotnet watch 🔥 [Ogma3 (net10.0)] Hot reload succeeded.

Regression?

No response

Known Workarounds

No response

Configuration

  • .NET 10
  • Win 11
  • x64

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area ownersuntriagedNew issue has not been triaged by the area owner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions