U4-6113 - Cannot delete member with upload field

Created by Per Ploug 13 Jan 2015, 12:32:28 Updated by Shannon Deminick 02 Jul 2015, 15:20:37

Tried to delete member from 7.2 members listview and member "Actions" menu on the member profile, receive the below error in both cases, doesnt matter if member is in groups or not.

Failed to delete item fcb0f25a96374cb381a2976708249d1e

`Object reference not set to an instance of an object.

EXCEPTION DETAILS:

System.NullReferenceException: Object reference not set to an instance of an object. STACKTRACE:

at Umbraco.Core.Persistence.Repositories.MemberRepository.PersistDeletedItem(IMember entity) at Umbraco.Core.Persistence.Repositories.RepositoryBase2.PersistDeletedItem(IEntity entity) at Umbraco.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit(Action1 transactionCompleting) at Umbraco.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit() at Umbraco.Core.Services.MemberService.Delete(IMember member) at Umbraco.Web.Editors.MemberController.DeleteByKey(Guid key) at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.b__c(Object instance, Object[] methodParameters) at `

Comments

Anton 15 Jan 2015, 10:41:26

Hi Have you found a solution for this problem ?


Anton 15 Jan 2015, 10:41:47

And I'm running 7.2.1


Anton 15 Jan 2015, 11:04:02

And here is my stack

at Umbraco.Core.Persistence.Repositories.MemberRepository.PersistDeletedItem(IMember entity) in d:\Dev\Umbraco-CMS\src\Umbraco.Core\Persistence\Repositories\MemberRepository.cs:line 394 at Umbraco.Core.Persistence.Repositories.RepositoryBase2.PersistDeletedItem(IEntity entity) in d:\Dev\Umbraco-CMS\src\Umbraco.Core\Persistence\Repositories\RepositoryBase.cs:line 286 at Umbraco.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit(Action1 transactionCompleting) in d:\Dev\Umbraco-CMS\src\Umbraco.Core\Persistence\UnitOfWork\PetaPocoUnitOfWork.cs:line 113 at Umbraco.Core.Services.MemberService.Delete(IMember member) in d:\Dev\Umbraco-CMS\src\Umbraco.Core\Services\MemberService.cs:line 927 at Umbraco.Web.Editors.MemberController.DeleteByKey(Guid key) at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.b__c(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)


Andy Butland 18 Jan 2015, 18:44:20

Running the source of 7.2.2, can't seem to replicate this - have tried with member within member group and in no groups. Maybe fixed?


Josh Olson 04 Feb 2015, 10:53:53

I have the same problem. I was waiting for 7.2.2 to be 'official' before upgrading, but I am hoping that it will be 'fixed' there.


Anton 05 Feb 2015, 09:08:54

Hi I'm running SQLCE so if you want me to zip my project and upload it in your mission to find the problem just let me know


Josh Olson 24 Feb 2015, 21:44:49

I think there may be something with the upload field that is causing the problem. I have started a new thread over on Our with more information. https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/61681-Cannot-delete-member-with-Upload-datatype-in-722


Josh Olson 25 Feb 2015, 07:42:17

The bug has been found. The null exception is due to empty upload properties on the member. If these fields are filled, no error and the member is deleted. If any upload field on that member is empty, null exception.

Now we just need a bug squasher...


Josh Olson 15 Jun 2015, 13:27:40

This bug still exists in 7.2.6


Yakov Lebski 21 Jun 2015, 17:27:34

issues src/Umbraco.Core/Persistence/Repositories/MemberRepository.cs - >PersistDeletedItem line 394 just add additional check for null :property.Value!=null

if (property.PropertyType.PropertyEditorAlias == uploadFieldAlias && property.Value!=null && string.IsNullOrEmpty(property.Value.ToString()) == false && fs.FileExists(fs.GetRelativePath(property.Value.ToString())))


Shannon Deminick 02 Jul 2015, 14:52:01

Hrm, this is actually part of a bigger problem. This logic shouldn't exist in the repository at all and it's still incorrect because it's not checking anything for the image cropper, etc... The image deletion logic needs to be handled by an event.

Anyways, I'll fix it.


Shannon Deminick 02 Jul 2015, 15:20:32

Fixed in rev: c917fc37ae8a3569a813d3588f0cb71bc05898ad


Priority: Normal

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.2.0, 7.2.1, 7.2.2, 7.2.3, 7.2.4, 7.2.5, 7.2.6

Due in version: 7.3.0

Sprint:

Story Points:

Cycle: