@@ -173,19 +173,19 @@ private T GetSyncInternal(params object[] objects)
173
173
throw new NullReferenceException ( Constants . InitializationFuncError ) ;
174
174
175
175
// Not a great situation here - we only have async initialization but we're calling this synchronously... so we'll block
176
- return _asyncObjectFunc ( objects ) . NoSync ( ) . GetAwaiter ( ) . GetResult ( ) ;
176
+ return _asyncObjectFunc ( objects ) . AwaitSync ( ) ;
177
177
case InitializationType . AsyncObjectToken :
178
178
if ( _asyncObjectTokenFunc is null )
179
179
throw new NullReferenceException ( Constants . InitializationFuncError ) ;
180
180
181
181
// Not a great situation here - we only have async initialization but we're calling this synchronously... so we'll block
182
- return _asyncObjectTokenFunc ( CancellationToken . None , objects ) . NoSync ( ) . GetAwaiter ( ) . GetResult ( ) ;
182
+ return _asyncObjectTokenFunc ( CancellationToken . None , objects ) . AwaitSync ( ) ;
183
183
case InitializationType . Async :
184
184
if ( _asyncFunc is null )
185
185
throw new NullReferenceException ( Constants . InitializationFuncError ) ;
186
186
187
187
// Not a great situation here - we only have async initialization but we're calling this synchronously... so we'll block
188
- return _asyncFunc ( ) . NoSync ( ) . GetAwaiter ( ) . GetResult ( ) ;
188
+ return _asyncFunc ( ) . AwaitSync ( ) ;
189
189
case InitializationType . SyncObject :
190
190
if ( _objectFunc is null )
191
191
throw new NullReferenceException ( Constants . InitializationFuncError ) ;
@@ -283,7 +283,7 @@ public void Dispose()
283
283
// Handle IAsyncDisposable in a synchronous context
284
284
else if ( localInstance is IAsyncDisposable asyncDisposable )
285
285
{
286
- asyncDisposable . DisposeAsync ( ) . NoSync ( ) . GetAwaiter ( ) . GetResult ( ) ;
286
+ asyncDisposable . DisposeAsync ( ) . AwaitSync ( ) ;
287
287
}
288
288
289
289
// Clear the instance reference and suppress finalization
0 commit comments