Skip to content

Commit

Permalink
null!
Browse files Browse the repository at this point in the history
  • Loading branch information
msftrubengu committed Nov 10, 2023
1 parent a7df0a0 commit 0102923
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ internal sealed class PackageManagerWrapper
{
private static readonly Lazy<PackageManagerWrapper> Lazy = new (() => new PackageManagerWrapper());

private PackageManager? packageManager = null;
private PackageManager packageManager = null!;

private PackageManagerWrapper()
{
Expand All @@ -45,7 +45,7 @@ public static PackageManagerWrapper Instance
public IAsyncOperationWithProgress<InstallResult, InstallProgress> InstallPackageAsync(CatalogPackage package, InstallOptions options)
{
return this.Execute(
() => this.packageManager!.InstallPackageAsync(package, options),
() => this.packageManager.InstallPackageAsync(package, options),
false);
}

Expand All @@ -58,7 +58,7 @@ public IAsyncOperationWithProgress<InstallResult, InstallProgress> InstallPackag
public IAsyncOperationWithProgress<InstallResult, InstallProgress> UpgradePackageAsync(CatalogPackage package, InstallOptions options)
{
return this.Execute(
() => this.packageManager!.UpgradePackageAsync(package, options),
() => this.packageManager.UpgradePackageAsync(package, options),
false);
}

Expand All @@ -71,7 +71,7 @@ public IAsyncOperationWithProgress<InstallResult, InstallProgress> UpgradePackag
public IAsyncOperationWithProgress<UninstallResult, UninstallProgress> UninstallPackageAsync(CatalogPackage package, UninstallOptions options)
{
return this.Execute(
() => this.packageManager!.UninstallPackageAsync(package, options),
() => this.packageManager.UninstallPackageAsync(package, options),
false);
}

Expand All @@ -82,7 +82,7 @@ public IAsyncOperationWithProgress<UninstallResult, UninstallProgress> Uninstall
public IReadOnlyList<PackageCatalogReference> GetPackageCatalogs()
{
return this.Execute(
() => this.packageManager!.GetPackageCatalogs(),
() => this.packageManager.GetPackageCatalogs(),
true);
}

Expand All @@ -94,7 +94,7 @@ public IReadOnlyList<PackageCatalogReference> GetPackageCatalogs()
public PackageCatalogReference GetPackageCatalogByName(string source)
{
return this.Execute(
() => this.packageManager!.GetPackageCatalogByName(source),
() => this.packageManager.GetPackageCatalogByName(source),
true);
}

Expand All @@ -106,7 +106,7 @@ public PackageCatalogReference GetPackageCatalogByName(string source)
public PackageCatalogReference CreateCompositePackageCatalog(CreateCompositePackageCatalogOptions options)
{
return this.Execute(
() => this.packageManager!.CreateCompositePackageCatalog(options),
() => this.packageManager.CreateCompositePackageCatalog(options),
false);
}

Expand All @@ -132,7 +132,7 @@ private TReturn Execute<TReturn>(Func<TReturn> func, bool canRetry)
}
catch (COMException ex) when (ex.HResult == ErrorCode.RpcServerUnavailable || ex.HResult == ErrorCode.RpcCallFailed)
{
this.packageManager = null;
this.packageManager = null!;

if (stopRetry || !canRetry)
{
Expand Down

0 comments on commit 0102923

Please sign in to comment.