© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
1 reply
Alerin

❔ System.Reflection.ReflectionTypeLoadException: „Unable to load one or more of the requested types.

System.Reflection.ReflectionTypeLoadException: „Unable to load one or more of the requested types.
Could not load type 'SqlGuidCaster' from assembly 'Microsoft.Data.SqlClient, Version=5.0.0.0, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5' because it contains an object field at offset 0 that is incorrectly aligned or overlapped by a non-object field.”
System.Reflection.ReflectionTypeLoadException: „Unable to load one or more of the requested types.
Could not load type 'SqlGuidCaster' from assembly 'Microsoft.Data.SqlClient, Version=5.0.0.0, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5' because it contains an object field at offset 0 that is incorrectly aligned or overlapped by a non-object field.”

in code:
    private IEnumerable<Assembly> Types()
        => GetAssemblies()
            .SelectMany(s => s.GetTypes())
            .Where(p =>
                    p.IsClass &&
                    p.IsAbstract == false &&
                    typeof(IAreaWeb).IsAssignableFrom(p)
                )
            .Select(x => x.Assembly);
    private IEnumerable<Assembly> Types()
        => GetAssemblies()
            .SelectMany(s => s.GetTypes())
            .Where(p =>
                    p.IsClass &&
                    p.IsAbstract == false &&
                    typeof(IAreaWeb).IsAssignableFrom(p)
                )
            .Select(x => x.Assembly);

in line:
s.GetTypes()
s.GetTypes()

I upgraded from .net 7 to .net 8. Anyone have any idea how to fix this error?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ ✅ Use Reflection or Generics to specify one or more properties
C#CC# / help
3y ago
BindingFlags of System.Reflection
C#CC# / help
5mo ago
❔ System.Reflection
C#CC# / help
4y ago
Reflection Load Interface Instance
C#CC# / help
16mo ago