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

Update nuget packages to fix conflicting version bug #112

Merged
merged 1 commit into from
Mar 1, 2021

Conversation

Hona
Copy link
Contributor

@Hona Hona commented Feb 26, 2021

Specifically to address a bug with conflicting versions of AutoMapper

@Hona Hona changed the title Update nuget packages Update nuget packages to fix conflicting version bug Feb 26, 2021
@Hona
Copy link
Contributor Author

Hona commented Feb 26, 2021

If possible can this get pushed to nuget once approved?

@babelshift
Copy link
Owner

babelshift commented Feb 26, 2021

What exactly is this fixing? I know the PR title says something about AutoMapper conflict. The unit tests as part of the CI/CD process are not showing any issues related to that. Can you help me with steps to reproduce?

Also, is there any reason why you chose to use Microsoft.Extensions.DependencyInjection 5.0.1 but Microsoft.Extensions.Options 5.0.0?

@Hona
Copy link
Contributor Author

Hona commented Feb 26, 2021

The packages are all the latest as far as my IDE can tell.

The bug is when your own project is using the latest version of AutoMapper as well, causing this bug;

System.MissingMethodException: Method not found: '!!1 AutoMapper.IMapper.Map(!!0)'.
   at SteamWebAPI2.Interfaces.SteamUser.GetPlayerSummaryAsync(UInt64 steamId)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at SteamWebAPI2.Interfaces.SteamUser.GetPlayerSummaryAsync(UInt64 steamId)
   at Momentum.Auth.Api.Services.SteamService.BuildUserFromProfile(String steamId) in /src/API/src/Modules/Auth/Momentum.Auth.Api/Services/SteamService.cs:line 127
   at Momentum.Auth.Api.Controllers.SteamController.<SignInAsync>b__4_0() in /src/API/src/Modules/Auth/Momentum.Auth.Api/Controllers/SteamController.cs:line 48
   at Momentum.Users.Application.Commands.GetOrCreateNewUserCommandHandler.Handle(GetOrCreateNewUserCommand request, CancellationToken cancellationToken) in /src/API/src/Modules/Users/Momentum.Users.Application/Commands/GetOrCreateNewUserCommand.cs:line 70
   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)
   at Momentum.Auth.Api.Controllers.SteamController.SignInAsync() in /src/API/src/Modules/Auth/Momentum.Auth.Api/Controllers/SteamController.cs:line 45
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

The solution is just to update according to https://stackoverflow.com/questions/63519439/automapper-issue-with-identityserver4-missingmethodexception-method-not-found

@Hona
Copy link
Contributor Author

Hona commented Feb 26, 2021

https://www.nuget.org/packages/Microsoft.Extensions.Options/

The package is not at 5.0.1

@Mats391
Copy link

Mats391 commented Feb 28, 2021

Would be great if this got accepted. Just broke production by updating AutoMapper for another component :D

@Hona
Copy link
Contributor Author

Hona commented Feb 28, 2021

A temporary workaround is to downgrade your own AutoMapper to v9 - or building my fix branch

@babelshift babelshift merged commit a831c56 into babelshift:master Mar 1, 2021
@babelshift
Copy link
Owner

@Hona thanks for your contribution. I'll build the NuGet package and push it out today.

@babelshift
Copy link
Owner

4.3.0 has been pushed to the NuGet feed.

Trekkan pushed a commit to Trekkan/SteamWebAPI2 that referenced this pull request Mar 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants