umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
Other
4.49k stars 2.69k forks source link

Error when saving members with ContentPicker properties #14329

Closed SergioMSCosta closed 1 year ago

SergioMSCosta commented 1 year ago

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

11.4.0

Bug summary

When trying to save a member that has a value in a ContentPicker property we get the following error:

Could not load type 'NPoco.ProcessMapperExtensions' from assembly 'NPoco, Version=5.7.1.0, Culture=neutral, PublicKeyToken=null'.

Specifics

No response

Steps to reproduce

  1. Create a member property that is a ContentPicker
  2. Select content for that property
  3. Try saving

This does not happen if the property is not filled.

Expected result / actual result

No response

github-actions[bot] commented 1 year ago

Hi there @SergioMSCosta!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:

andr317c commented 1 year ago

Hey! Thanks for reporting this. I tried to reproduce your issue, but I was not able to do it. Here is a gif of what I tried: MemberPicker

Please let me know if there are any additional reproduction steps 😄

From the error message you got, I would recommend trying clearing your Nuget cache to see if that fixes your problem!

SergioMSCosta commented 1 year ago

Hey! Thank you very much for looking into it. Unfortunately, clearing the Nuget cache did not work.

I forgot to add something: this is a database that was migrated from v8.

andr317c commented 1 year ago

Hey again! I tried migrating a database from v8.18.8 to v11.4.0 and followed the reproduction steps again. I was sadly not able to reproduce the issue.

SergioMSCosta commented 1 year ago

Ouch. That's bad news for me then, I guess. I really don't have any more data I can provide to help out on trying to replicate the problem. I'll have to find an alternative way to save that data as this is a production database and I need to make those changes as fast as possible.

Thank you very much for looking into it.

I'm leaving all the error's details here, just in case it helps someone that may take a look at it.

andr317c commented 1 year ago

I'll go ahead and close this issue. If you find any more information, please feel free to comment, and we can have another look 😃

SergioMSCosta commented 1 year ago

My apologies. I was just told by a fellow developer that the application was actually migrated from 7.15.8.

It reached my hands in 8.2.0 but it had been previously migrated. I missed that piece of information before.

Also, here is the complete error I get when I try to save the member.

An error occurred
Could not load type 'NPoco.ProcessMapperExtensions' from assembly 'NPoco, Version=5.7.1.0, Culture=neutral, PublicKeyToken=null'.

Exception Details
System.TypeLoadException, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e: Could not load type 'NPoco.ProcessMapperExtensions' from assembly 'NPoco, Version=5.7.1.0, Culture=neutral, PublicKeyToken=null'.
Stacktrace
at NPoco.SqlServer.SqlBulkCopyHelper.BuildBulkInsertDataTable[T](IDatabase db, IEnumerable`1 list, SqlBulkCopy bulkCopy, SqlBulkCopyOptions sqlBulkCopyOptions, InsertBulkOptions insertBulkOptions)
   at NPoco.SqlServer.SqlBulkCopyHelper.BulkInsert[T](IDatabase db, IEnumerable`1 list, SqlBulkCopyOptions sqlBulkCopyOptions, InsertBulkOptions insertBulkOptions)
   at NPoco.SqlServer.SqlBulkCopyHelper.BulkInsert[T](IDatabase db, IEnumerable`1 list, InsertBulkOptions insertBulkOptions)
   at NPoco.DatabaseTypes.SqlServerDatabaseType.InsertBulk[T](IDatabase db, IEnumerable`1 pocos, InsertBulkOptions options)
   at NPoco.Database.InsertBulk[T](IEnumerable`1 pocos, InsertBulkOptions options)
   at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.RelationRepository.SaveBulk(IEnumerable`1 relations)
   at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.ContentRepositoryBase`3.PersistRelations(TEntity entity)
   at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.MemberRepository.PersistUpdatedItem(IMember entity)
   at Umbraco.Cms.Core.Cache.DefaultRepositoryCachePolicy`2.Update(TEntity entity, Action`1 persistUpdated)
   at Umbraco.Cms.Core.Services.MemberService.Save(IMember member)
   at Umbraco.Cms.Web.BackOffice.Controllers.MemberController.UpdateMemberAsync(MemberSave contentItem)
   at Umbraco.Cms.Web.BackOffice.Controllers.MemberController.PostSave(MemberSave contentItem)
   at lambda_method1813(Closure, Object)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, 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()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
nikolajlauridsen commented 1 year ago

Hey @SergioMSCosta I also just had a look at reproducing this, however with no luck, unfortunately.

However I have a suspicion that this may not be upgrade related since the error your post is because it's trying to resolve the Npoco assembly in version 5.7.1, However, the CMS uses version 5.5.0 which does not contain the ProcessMapperExtensions that is trying to be loaded.

Are you manually setting the Npoco version to be 5.7.1? Either in your own project or through some dependency? If that's the case that may be why you're experiencing this and a downgrade back down to 5.5.0 may fix your issue.

SergioMSCosta commented 1 year ago

@nikolajlauridsen I can't thank you enough. I figured out another dependency was, in fact using 5.7.1 which was overriding Umbraco's version. I rolled it back on that project and it's now working. Thank you so much, guys!

I'll close this report now.

nikolajlauridsen commented 1 year ago

No worries, glad to be of help 🎉