question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

It is not possible to configure a mapping between an open generic type and a nongeneric or closed generic type

See original GitHub issue

The problem preventing open generic to nongeneric mappings (e.g. Id<> to int) and vice versa: TypePair.GetOpenGenericTypePair returns null unless both types are open generic types. Its only usage is in MapperConfiguration.FindClosedGenericTypeMapFor. Repro for this problem. I think I found a solution to this problem.

To enable mapping an open generic to closed generic (e.g. Id<> to Value<int>) and vice versa, another lookup may be required.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:32 (23 by maintainers)

github_iconTop GitHub Comments

1reaction
jbogardcommented, Apr 4, 2016

And the last part is that it needs to be on NuGet as a non-pre-release package. There’s a deal with NuGet packages that if your package depends on a pre-release, then you have to mark as pre-release.

1reaction
jbogardcommented, Apr 4, 2016

To be toooooootally transparent here, I’m waiting for .NET Core RC2 - not ASP.NET Core RC2. ASP.NET RC2 does not have a date yet (https://github.com/aspnet/Mvc/milestones). Yes this confused me too.

The reason why I’m waiting is for the new netstandard TFN to be available in VS and all the other tools.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AutoMapper Open Generics Mapping Not Working
I am trying to setup a map to utilize open generics, but it never works at runtime. I'm using AutoMapper 5.2 in .NET...
Read more >
Open Generics
Type version of CreateMap to create your open generic type maps. From there, you can use all of the mapping configuration available and...
Read more >
Open and Closed Generic Types in C# | Pluralsight
Types in C# have two main categories: value and reference types. Both may be generic types, which take one or more type parameters....
Read more >
Advanced Scenarios — Simple Injector 5 documentation
Registering open generic types and working with partially-closed types; Mixing collections of open-generic and non-generic components; Resolving Covariant/ ...
Read more >
Generics: in, out, where
First, generic types in Java are invariant, meaning that List<String> is not a subtype of List<Object> . If List were not invariant, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found