Hi,
Till the time we were on ABP version 3.0.0, everything was fine. Recently we upgraded all the Nugets of ABP from 3.0.0 to 3.6.0 and today again updated all the ABP Nugets to 3.6.1 along with the associated nugets to the latest version..
Now in the SessionAppService.cs class, I am getting the AutoMapper Error in the code written inside the If block.
if (AbpSession.TenantId.HasValue) {
output.Tenant = ObjectMapper
.Map<TenantLoginInfoDto>(await TenantManager
.Tenants
.Include(t => t.Edition)
.FirstAsync(t => t.Id == AbpSession.GetTenantId()));
}
I am getting following error. Please help me to resolve this error....
Mapping types: Tenant -> TenantLoginInfoDto CitiXsys.iVend365.MultiTenancy.Tenant -> CitiXsys.iVend365.Sessions.Dto.TenantLoginInfoDto
Type Map configuration: Tenant -> TenantLoginInfoDto CitiXsys.iVend365.MultiTenancy.Tenant -> CitiXsys.iVend365.Sessions.Dto.TenantLoginInfoDto
Property: Edition AutoMapper.AutoMapperMappingException: Error mapping types.
Mapping types: Tenant -> TenantLoginInfoDto CitiXsys.iVend365.MultiTenancy.Tenant -> CitiXsys.iVend365.Sessions.Dto.TenantLoginInfoDto
Type Map configuration: Tenant -> TenantLoginInfoDto CitiXsys.iVend365.MultiTenancy.Tenant -> CitiXsys.iVend365.Sessions.Dto.TenantLoginInfoDto
Property: Edition ---> AutoMapper.AutoMapperConfigurationException: Unmapped members were found. Review the types and members below. Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type For no matching constructor, add a no-arg ctor, add optional arguments, or map all of the constructor parameters
Edition -> EditionInfoDto (Destination member list) Abp.Application.Editions.Edition -> CitiXsys.iVend365.Sessions.Dto.EditionInfoDto (Destination member list)
Unmapped properties: TrialDayCount MonthlyPrice AnnualPrice IsHighestEdition IsFree
at AutoMapper.ConfigurationValidator.AssertConfigurationIsValid(IEnumerable1 typeMaps) at lambda_method(Closure , Tenant , TenantLoginInfoDto , ResolutionContext ) --- End of inner exception stack trace --- at lambda_method(Closure , Tenant , TenantLoginInfoDto , ResolutionContext ) at lambda_method(Closure , Object , Object , ResolutionContext ) at AutoMapper.Mapper.AutoMapper.IMapper.Map[TDestination](Object source) at CitiXsys.iVend365.Sessions.SessionAppService.<GetCurrentLoginInformations>d__0.MoveNext() in D:\CXS.Retail\Development\iVend365\src\CitiXsys.iVend365.Application\Sessions\SessionAppService.cs:line 42 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__51.MoveNext() in D:\Github\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:line 120
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at CitiXsys.iVend365.Web.Session.PerRequestSessionCache.<GetCurrentLoginInformationsAsync>d__3.MoveNext() in D:\CXS.Retail\Development\iVend365\src\CitiXsys.iVend365.Web.Core\Session\PerRequestSessionCache.cs:line 33 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at CitiXsys.iVend365.Web.Views.Shared.Components.TenantChange.TenantChangeViewComponent.<InvokeAsync>d__2.MoveNext() in D:\CXS.Retail\Development\iVend365\src\CitiXsys.iVend365.Web.Mvc\Views\Shared\Components\TenantChange\TenantChangeViewComponent.cs:line 18
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.<InvokeAsyncCore>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.<InvokeAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentHelper.<InvokeCoreAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at AspNetCore._Views_Account__Layout_cshtml.__Generated__TenantChangeViewComponentTagHelper.
11 Answer(s)
-
0
Add the missing mappings Tenant -> TenantLoginInfoDto CitiXsys.iVend365.MultiTenancy.Tenant -> CitiXsys.iVend365.Sessions.Dto.TenantLoginInfoDto
Add the mappings if not Edition -> EditionInfoDto Abp.Application.Editions.Edition -> CitiXsys.iVend365.Sessions.Dto.EditionInfoDto
And Ignore these property mappings TrialDayCount MonthlyPrice AnnualPrice IsHighestEdition IsFree
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi,
I did not understand you completely. Exactly in which file I need to add the missing mapping. Also When In old version (ABP 3.0) it is working, why after updating the ABP nuget to 3.6.1 it stopped working....
Regards, Mahendra
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Ensure your CustomDtoMapper.cs is up-to-date.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
As I said, I have not changed anything except updating the ABP Nuget from 3.0.0 to 3.6.1 and also updated the other nugets to the latest version.
Now I have two solutions, One with ASPNetZero 4.5 having ABP 3.0.0 and Other with ASPNetZero still 4.5 but ABP 3.6.1 (Because I only updated the ABP nugets.)
And the reason to upgrade the ABP nuget is, I want to implement SignalR which is only supported on ABP >=3.6.0
In the old solution its running absolutely fine, but in the new it is throwing error.... I am really stuck..... Please help....
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Try the suggested solution.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Thanks aaron....it worked....Many thanks for the solution....
Can you please just clarify one more thing to me....
So now I am on ASPNetZero 4.5 with ABP 3.6.1...... My question is if I do not upgrade to ASPNetZero to 5.4, Can I still use SignalR....
Regards, Mahendra
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Yes, just follow the documentation for SignalR AspNetCore Integration.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Thanks...Much appreciated....
Regards, Mahendra
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi Aaron,
I got stuck again.... I have Linq Query, that returns me an anonymous entity. Now, when I try to map the above anonymous entity to one of my DTO (of course my anonymous entity does not have all the properties that the DTO has), I have to write following code before mapping it to my DTO.
Mapper.Initialize(cfg => cfg.CreateMissingTypeMaps = true);
Now this code is throwing following error..
Mapper already initialized. You must call Initialize once per application domain/process.
I tried commenting this code
//Mapper.Initialize(cfg => cfg.CreateMissingTypeMaps = true);and instead tried writing the following code in CustomDtoMapper.cs configuration.CreateMissingTypeMaps = true;
But still the Automapper is throwing error of missing map while mapping the anonymous entity to DTO...
Please advise....
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
I have Linq Query, that returns me an anonymous entity. Now, when I try to map the above anonymous entity to one of my DTO
That's an anonymous object, not an entity.
A better solution is to Select(x => new Dto {}) instead of trying to map after Select(x => new {}).
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Agree what you are saying....
but is there any alternate, so I will save my lots of time to refactor the code as per your suggestion....
Regards, Mahendra
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)