Skip to content

ObjectDisposedException (IServiceProvider) after DataPortalException in SaveAsync with AutoCloneOnUpdate=false #4223

@ka-fim

Description

@ka-fim

Describe the bug
Can't access any managed property of a business object (throwing ObjectDisposedException) after trying to save it and an exception occured in a DataPortal method

Version and Platform
CSLA version: 8.2.7
OS: Windows (probably independent but not tested)
Platform: Console App, WPF (probably independent but not tested)

Code that Fails
https://github.com/ka-fim/CslaIServiceProviderDisposedException

Stack Trace or Exception Detail
System.ObjectDisposedException
HResult=0x80131622
Message=Cannot access a disposed object.
Object name: 'IServiceProvider'.
Source=Microsoft.Extensions.DependencyInjection
StackTrace:
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ThrowHelper.ThrowObjectDisposedException()
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Csla.Core.ApplicationContextAccessor.GetContextManager()
at Csla.ApplicationContext.get_ContextManager()
at Csla.ApplicationContext.get_User()
at Csla.Core.BusinessBase.VerifyAuthorizationCache()
at Csla.Core.BusinessBase.CanWriteProperty(IPropertyInfo property)
at Csla.Core.BusinessBase.CanWriteProperty(IPropertyInfo property, Boolean throwOnFalse)
at Csla.Core.BusinessBase.SetProperty[P](PropertyInfo1 propertyInfo, P newValue, NoAccessBehavior noAccess) at Csla.Core.BusinessBase.SetProperty[P](PropertyInfo1 propertyInfo, P newValue)
at CslaIServiceProviderDisposedException.DataPortalExceptionBusinessObject.set_Name(String value) in C:\TestProjects\CslaIServiceProviderDisposedException\DataPortalExceptionBusinessObject.cs:line 13
at Program.<

$>d__0.MoveNext() in C:\TestProjects\CslaIServiceProviderDisposedException\Program.cs:line 31

Additional context
Setting up the DataPortal with UseLocalProxy and AutoCloneOnUpdate = false

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions