@@ -538,28 +538,34 @@ private static IComparable GetConfiguredProjectVersion(IProjectValueVersions upd
538538 return update . DataSourceVersions [ ProjectDataSources . ConfiguredProjectVersion ] ;
539539 }
540540
541- public async Task WriteAsync ( Func < IWorkspace , Task > action , CancellationToken cancellationToken )
541+ public Task WriteAsync ( Func < IWorkspace , Task > action , CancellationToken cancellationToken )
542542 {
543543 Requires . NotNull ( action ) ;
544- Verify . NotDisposed ( this ) ;
545544
546545 cancellationToken = CancellationTokenExtensions . CombineWith ( _unloadCancellationToken , cancellationToken ) . Token ;
547546
548- await WhenContextCreated ( cancellationToken ) ;
547+ return ExecuteUnderLockAsync ( async _ =>
548+ {
549+ await WhenContextCreated ( cancellationToken ) ;
549550
550- await ExecuteUnderLockAsync ( _ => action ( this ) , cancellationToken ) ;
551+ await action ( this ) ;
552+ } ,
553+ cancellationToken ) ;
551554 }
552555
553- public async Task < T > WriteAsync < T > ( Func < IWorkspace , Task < T > > action , CancellationToken cancellationToken )
556+ public Task < T > WriteAsync < T > ( Func < IWorkspace , Task < T > > action , CancellationToken cancellationToken )
554557 {
555558 Requires . NotNull ( action ) ;
556- Verify . NotDisposed ( this ) ;
557559
558560 cancellationToken = CancellationTokenExtensions . CombineWith ( _unloadCancellationToken , cancellationToken ) . Token ;
559561
560- await WhenContextCreated ( cancellationToken ) ;
562+ return ExecuteUnderLockAsync ( async _ =>
563+ {
564+ await WhenContextCreated ( cancellationToken ) ;
561565
562- return await ExecuteUnderLockAsync ( _ => action ( this ) , cancellationToken ) ;
566+ return await action ( this ) ;
567+ } ,
568+ cancellationToken ) ;
563569 }
564570
565571 private async Task WhenContextCreated ( CancellationToken cancellationToken )
0 commit comments