Fix for the issue where PT Run was preventing UWP apps from building in VS (#5109)

* We should not deny other processes access to this item

* added a catch block for argument exception

* using memory stream instead of URI

* removed denyNone as it is the default config
This commit is contained in:
Alekhya
2020-07-21 10:26:37 -07:00
committed by GitHub
parent 1ba403db7b
commit b31d9761fa
2 changed files with 26 additions and 13 deletions

View File

@@ -1,4 +1,5 @@
using Microsoft.Plugin.Program.Logger;
using System;
using System.IO;
using Package = Windows.ApplicationModel.Package;
@@ -32,22 +33,26 @@ namespace Microsoft.Plugin.Program.Programs
public static PackageWrapper GetWrapperFromPackage(Package package)
{
string path;
try
{
return new PackageWrapper(
package.Id.Name,
package.Id.FullName,
package.Id.FamilyName,
package.IsFramework,
package.IsDevelopmentMode,
package.InstalledLocation.Path
);
path = package.InstalledLocation.Path;
}
catch(FileNotFoundException ex)
catch (Exception e) when (e is ArgumentException || e is FileNotFoundException)
{
ProgramLogger.LogException($"PackageWrapper", "GetWrapperFromPackage","package.InstalledLocation.Path",$"File Not Found for package {package.Id.Name}", ex);
ProgramLogger.LogException($"PackageWrapper", "GetWrapperFromPackage", "package.InstalledLocation.Path", $"Exception {package.Id.Name}", e);
return new PackageWrapper();
}
return new PackageWrapper(
package.Id.Name,
package.Id.FullName,
package.Id.FamilyName,
package.IsFramework,
package.IsDevelopmentMode,
path
);
}
}
}