This error is sporadic, always on different place. It usually shows when application starts.
Full error:
System.Reflection.ReflectionTypeLoadException: 'Unable to load one or more of the requested types.
Could not load type 'Castle.Proxies.ProductionDataProxy' from assembly 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
Could not load type 'Castle.Proxies.Invocations.ProductionData_set_ProductionDataType' from assembly 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.'
It's always different type, mostly in EFCore context. Sometimes in other places where types are loading.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.Assembly.GetTypes()
at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at BaseDbContext..ctor(DbContextOptions options)
at XXX.DatioContext..ctor(DbContextOptions`1 options) in
C:\XXX\DatioContext.cs:line 36
My projects are .NET 7 projects with few hosted services and controllers. I have no idea what's the problem. Is it a .NET 7 bug?
Thanks!