Closed arit1988 closed 1 year ago
Hi arit1988,
Can you tell me more about what kind of project/program this code is executed in? I am aware that in async code, you may run into issues in some circumstances. This is because Mapster currently uses AsyncLocal
.net 6.0 when use MapContext.Current.GetService to get service,an exception happened
An unhandled exception has occurred while executing the request. System.InvalidOperationException: Mapping must be called using ServiceAdapter at Mapster.TypeAdapterExtensions.GetService[TService](MapContext context) at mapster_codegen.ApiMapper.MapToExisting(Source p1, Dest p2) in O:\Projects\test\mapster-codegen\Mappers\ApiMapper.g.cs:line 12 at mapster_codegen.Controllers.WeatherForecastController.Get() in O:\Projects\test\mapster-codegen\Controllers\WeatherForecastController.cs:line 28 at lambda_method4(Closure, Object, Object[]) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)