Language-ext: ASP.NET Core TypeLoadException with Lst<A>

Created on 11 Apr 2019  Â·  7Comments  Â·  Source: louthy/language-ext

Hi,

First of all, thanks for your library; it's great to write functional code with C#! Thing is, now that I've finished implementing the back-end of my controller, I'm starting to connect the front-end to it and it causes me some issues. I don't wanrt to avoid using this NuGet because it looks really great, but I'd have no choice if I get resolve this! Do you have any idea of what to do here?

An unhandled exception occurred while processing the request.
TypeLoadException: Could not load type 'LanguageExt.Lst`1' from assembly 'LanguageExt.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=cb8021e93c7abc03'.

Raw exception details:

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

Could not load type 'LanguageExt.Lst`1' from assembly 'LanguageExt.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=cb8021e93c7abc03'.

Could not load type 'LanguageExt.Lst`1' from assembly 'LanguageExt.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=cb8021e93c7abc03'.

Could not load type 'LanguageExt.Lst`1' from assembly 'LanguageExt.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=cb8021e93c7abc03'.

at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)

at System.Reflection.RuntimeAssembly.get_DefinedTypes()

at Microsoft.AspNetCore.Mvc.ApplicationParts.AssemblyPart.get_Types()

at Microsoft.AspNetCore.Mvc.Controllers.ControllerFeatureProvider.PopulateFeature(IEnumerable`1 parts, ControllerFeature feature)

at Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager.PopulateFeatureTFeature

at Microsoft.AspNetCore.Mvc.Internal.ControllerActionDescriptorProvider.GetControllerTypes()

at Microsoft.AspNetCore.Mvc.Internal.ControllerActionDescriptorProvider.BuildModel()

at Microsoft.AspNetCore.Mvc.Internal.ControllerActionDescriptorProvider.GetDescriptors()

at Microsoft.AspNetCore.Mvc.Internal.ControllerActionDescriptorProvider.OnProvidersExecuting(ActionDescriptorProviderContext context)

at Microsoft.AspNetCore.Mvc.Internal.ActionDescriptorCollectionProvider.UpdateCollection()

at Microsoft.AspNetCore.Mvc.Internal.ActionDescriptorCollectionProvider.get_ActionDescriptors()

at Microsoft.AspNetCore.Mvc.Internal.AttributeRoute.GetTreeRouter()

at Microsoft.AspNetCore.Mvc.Internal.AttributeRoute.RouteAsync(RouteContext context)

at Microsoft.AspNetCore.Routing.RouteCollection.RouteAsync(RouteContext context)

at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)

at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)

at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)

at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)

at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)

at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

System.TypeLoadException: Could not load type 'LanguageExt.Lst`1' from assembly 'LanguageExt.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=cb8021e93c7abc03'.

System.TypeLoadException: Could not load type 'LanguageExt.Lst`1' from assembly 'LanguageExt.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=cb8021e93c7abc03'.

System.TypeLoadException: Could not load type 'LanguageExt.Lst`1' from assembly 'LanguageExt.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=cb8021e93c7abc03'.

Most helpful comment

v3.1.18 deployed now. Should deal with this issue.

All 7 comments

This just looks like you may have either mixed references to different versions of Lang-ext, or even a reference to the .net framework version rather than the .net core version.

So, I’d do some digging on your Nu-get references.

Just a heads up @louthy, this has just popped up for us immediately after updating to 3.1.16.
Although for us it's shown itself with Array System.TypeLoadException: Could not load type 'LanguageExt.Arr1' from assembly 'LanguageExt.Core. Have confirmed there is only oneLanguageExt` being referenced, previous updates have been fine.
Still investigating.

I checked and I also have a single LanguageExt.Core package reference in my
project

On Thu, Apr 11, 2019 at 8:33 PM Chad Edrupt notifications@github.com
wrote:

Just a heads up @louthy https://github.com/louthy, this has just popped
up for us immediately after updating to 3.1.16.
Although for us it's shown itself with Array System.TypeLoadException:
Could not load type 'LanguageExt.Arr1' from assembly 'LanguageExt.Core.
Have confirmed there is only one LanguageExt` being referenced, previous
updates have been fine.
Still investigating.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/louthy/language-ext/issues/574#issuecomment-482390312,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGbZ-kTdBCVGtfJ0XmWxpyrJKEXc5URUks5vf9RTgaJpZM4cprLF
.

>

Kevin Avignon (B.eng)

Hmm, ok, seems odd. I’ll try and take a look later today.

I have a simple project with a single Record class that was referencing 3.1.15 and now fails with the following after upgrade to 3.1.16

System.TypeInitializationException: The type initializer for 'LanguageExt.RecordType`1' threw an exception. ---> System.TypeInitializationException: The type initializer for 'LanguageExt.ClassInstances.Class`1' threw an exception. ---> System.TypeLoadException: Could not load type 'LanguageExt.Lst`1' from assembly 'LanguageExt.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null'.
    at LanguageExt.ClassInstances.Class`1..cctor()
--- End of inner exception stack trace ---
    at LanguageExt.IL.GetHashCode[A](Boolean includeBase)
   at LanguageExt.RecordType`1..cctor()
--- End of inner exception stack trace ---
    at LanguageExt.Record`1.Equals(Object obj)

The code can be found here: https://github.com/twaddell/LanguageExtSandbox
Hope it helps your investigation

Yep, looks like I screwed up. Working on a fix now.

v3.1.18 deployed now. Should deal with this issue.

Was this page helpful?
0 / 5 - 0 ratings