Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The type arguments for method 'ExpressMapper.MappingServiceProvider.Register<T,TN>(T, TN)' cannot be inferred from the usage. Try specifying the type arguments explicitly. #127

Open
maelmahdy opened this issue Jan 30, 2017 · 4 comments
Assignees
Labels

Comments

@maelmahdy
Copy link

I'm getting this error after upgrading to v1.9.0,
i'm trying to map an entity with a lot of complex type & navigation properties to a similar DTO class but I got this exception:

The type arguments for method 'ExpressMapper.MappingServiceProvider.Register<T,TN>(T, TN)' cannot be inferred from the usage. Try specifying the type arguments explicitly.

   at CallSite.Target(Closure , CallSite , MappingServiceProvider , Object , Object )

   at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3[T0,T1,T2](CallSite site, T0 arg0, T1 arg1, T2 arg2)

   at ExpressMapper.MappingServiceProvider.MapNonGenericInternal(Type srcType, Type dstType, Object src, Object dest, Boolean dynamicTrial) in C:\Source\ExpressMapper\Expressmapper.Shared\MappingServiceProvider.cs:line 496

   at ExpressMapper.MappingServiceProvider.Map[T,TN](T src) in C:\Source\ExpressMapper\Expressmapper.Shared\MappingServiceProvider.cs:line 283

   at ExpressMapper.Mapper.Map[T,TN](T src) in C:\Source\ExpressMapper\Expressmapper.Shared\Mapper.cs:line 38

This was not happening with the previous version.

@anisimovyuriy ,
Can you fix this asap please, I only have 24 hours before the DEMO :)

@anisimovyuriy
Copy link
Member

Dear @mr-unicoder ,

My apologies for inconvenience and thanks a lot for your contribution!

I'll try but I'd recommend to downgrade to 1.8.x - the latest stable version as I cannot promise that it will be fixed during 24h as I have tough schedule right now.

Thanks for understanding!

@anisimovyuriy anisimovyuriy self-assigned this Jan 31, 2017
@anisimovyuriy
Copy link
Member

Dear @mr-unicoder ,

Can you provide some code to localize the issue as I wouldn't able to reproduce it.

Thanks a lot!

@JakeAlmer
Copy link

JakeAlmer commented Oct 31, 2017

I got the same error due to casting a class to a base class and using mapper to bring it back to the original class. Sounds contrived but makes sense in our code.

Example:
http://share.linqpad.net/o7tp6q.linq

void Main()
{
	AClass aClass = new AClass { PropertyOne = "test", PropertyTwo = "test2"};
	
	BaseClass baseClass = (BaseClass)aClass;
	
	AClass aClassAgain = baseClass.Map<BaseClass, AClass>();
}

public class BaseClass
{
	public string PropertyOne { get; set;}
}

public class AClass : BaseClass
{
	public string PropertyTwo { get; set;}
}

@loweva
Copy link

loweva commented May 9, 2018

We have received the same error, but have been unable to pinpoint the exact cause (i.e. reproduction scenario), as it doesn't happen consistently. The involved classes do not extend from any other class, so it doesn't seem to be the same as @JakeAlmer 's issue.

However it appears that perhaps there will be no more support for this project, as the last commit is from 16 months ago. @anisimovyuriy , can you please respond and/or let the community know if that is the case? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants