Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyKuhne committed Aug 25, 2016
1 parent b7e2dcc commit afe6f68
Show file tree
Hide file tree
Showing 16 changed files with 164 additions and 156 deletions.
20 changes: 10 additions & 10 deletions src/System.IO.IsolatedStorage/System.IO.IsolatedStorage.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.IO.IsolatedStorage",
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
uap101aot_Debug|Any CPU = uap101aot_Debug|Any CPU
uap101aot_Release|Any CPU = uap101aot_Release|Any CPU
uap101_Debug|Any CPU = uap101_Debug|Any CPU
uap101_Release|Any CPU = uap101_Release|Any CPU
Windows_Debug|Any CPU = Windows_Debug|Any CPU
Windows_Release|Any CPU = Windows_Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FAF5D1E4-BA43-4663-8429-C069066D75CB}.uap101aot_Debug|Any CPU.ActiveCfg = uap101aot_Debug|Any CPU
{FAF5D1E4-BA43-4663-8429-C069066D75CB}.uap101aot_Debug|Any CPU.Build.0 = uap101aot_Debug|Any CPU
{FAF5D1E4-BA43-4663-8429-C069066D75CB}.uap101aot_Release|Any CPU.ActiveCfg = uap101aot_Release|Any CPU
{FAF5D1E4-BA43-4663-8429-C069066D75CB}.uap101aot_Release|Any CPU.Build.0 = uap101aot_Release|Any CPU
{FAF5D1E4-BA43-4663-8429-C069066D75CB}.uap101_Debug|Any CPU.ActiveCfg = uap101_Debug|Any CPU
{FAF5D1E4-BA43-4663-8429-C069066D75CB}.uap101_Debug|Any CPU.Build.0 = uap101_Debug|Any CPU
{FAF5D1E4-BA43-4663-8429-C069066D75CB}.uap101_Release|Any CPU.ActiveCfg = uap101_Release|Any CPU
{FAF5D1E4-BA43-4663-8429-C069066D75CB}.uap101_Release|Any CPU.Build.0 = uap101_Release|Any CPU
{FAF5D1E4-BA43-4663-8429-C069066D75CB}.Windows_Debug|Any CPU.ActiveCfg = Windows_Debug|Any CPU
{FAF5D1E4-BA43-4663-8429-C069066D75CB}.Windows_Debug|Any CPU.Build.0 = Windows_Debug|Any CPU
{FAF5D1E4-BA43-4663-8429-C069066D75CB}.Windows_Release|Any CPU.ActiveCfg = Windows_Release|Any CPU
{FAF5D1E4-BA43-4663-8429-C069066D75CB}.Windows_Release|Any CPU.Build.0 = Windows_Release|Any CPU
{27225772-FE8B-49D7-8E58-29242D536130}.uap101aot_Debug|Any CPU.ActiveCfg = Windows_Release|Any CPU
{27225772-FE8B-49D7-8E58-29242D536130}.uap101aot_Debug|Any CPU.Build.0 = Windows_Release|Any CPU
{27225772-FE8B-49D7-8E58-29242D536130}.uap101aot_Release|Any CPU.ActiveCfg = Release|Any CPU
{27225772-FE8B-49D7-8E58-29242D536130}.uap101aot_Release|Any CPU.Build.0 = Release|Any CPU
{27225772-FE8B-49D7-8E58-29242D536130}.uap101_Debug|Any CPU.ActiveCfg = Windows_Release|Any CPU
{27225772-FE8B-49D7-8E58-29242D536130}.uap101_Debug|Any CPU.Build.0 = Windows_Release|Any CPU
{27225772-FE8B-49D7-8E58-29242D536130}.uap101_Release|Any CPU.ActiveCfg = Release|Any CPU
{27225772-FE8B-49D7-8E58-29242D536130}.uap101_Release|Any CPU.Build.0 = Release|Any CPU
{27225772-FE8B-49D7-8E58-29242D536130}.Windows_Debug|Any CPU.ActiveCfg = Windows_Debug|Any CPU
{27225772-FE8B-49D7-8E58-29242D536130}.Windows_Debug|Any CPU.Build.0 = Windows_Debug|Any CPU
{27225772-FE8B-49D7-8E58-29242D536130}.Windows_Release|Any CPU.ActiveCfg = Windows_Release|Any CPU
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.IO.IsolatedStorage.csproj">
<SupportedFramework>netcore50;$(AllXamarinFrameworks)</SupportedFramework>
<SupportedFramework>uap10.1;netcoreapp1.1;net463;$(AllXamarinFrameworks)</SupportedFramework>
</ProjectReference>
<ProjectReference Include="..\src\System.IO.IsolatedStorage.builds" />
</ItemGroup>
Expand Down
15 changes: 0 additions & 15 deletions src/System.IO.IsolatedStorage/ref/4.0.2/project.json

This file was deleted.

8 changes: 8 additions & 0 deletions src/System.IO.IsolatedStorage/ref/4.0/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"dependencies": {
"System.IO.IsolatedStorage": "4.0.0"
},
"frameworks": {
"netstandard1.4": { }
}
}
17 changes: 8 additions & 9 deletions src/System.IO.IsolatedStorage/ref/System.IO.IsolatedStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ protected IsolatedStorage() { }
protected virtual char SeparatorExternal { get { throw null; } }
protected virtual char SeparatorInternal { get { throw null; } }
public virtual long UsedSize { get { throw null; } }
// protected abstract System.Security.Permissions.IsolatedStoragePermission GetPermission(System.Security.PermissionSet ps);
public virtual bool IncreaseQuotaTo(long newQuotaSize) { throw null; }

protected void InitStore(System.IO.IsolatedStorage.IsolatedStorageScope scope, System.Type appEvidenceType) { }
Expand All @@ -42,8 +41,6 @@ protected void InitStore(System.IO.IsolatedStorage.IsolatedStorageScope scope, S
public partial class IsolatedStorageException : System.Exception
{
public IsolatedStorageException() { }
// PermissionSet isn't available in CoreFx
// protected IsolatedStorageException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public IsolatedStorageException(string message) { }
public IsolatedStorageException(string message, System.Exception inner) { }
}
Expand Down Expand Up @@ -83,12 +80,8 @@ public void Dispose() { }
public static System.IO.IsolatedStorage.IsolatedStorageFile GetMachineStoreForApplication() { throw null; }
public static System.IO.IsolatedStorage.IsolatedStorageFile GetMachineStoreForAssembly() { throw null; }
public static System.IO.IsolatedStorage.IsolatedStorageFile GetMachineStoreForDomain() { throw null; }
// PermissionSet isn't available in CoreFx
// protected override System.Security.Permissions.IsolatedStoragePermission GetPermission(System.Security.PermissionSet ps) { throw null; }
public static System.IO.IsolatedStorage.IsolatedStorageFile GetStore(System.IO.IsolatedStorage.IsolatedStorageScope scope, object applicationIdentity) { throw null; }
public static System.IO.IsolatedStorage.IsolatedStorageFile GetStore(System.IO.IsolatedStorage.IsolatedStorageScope scope, object domainIdentity, object assemblyIdentity) { throw null; }
// Evidence isn't available in CoreFx
// public static System.IO.IsolatedStorage.IsolatedStorageFile GetStore(System.IO.IsolatedStorage.IsolatedStorageScope scope, System.Security.Policy.Evidence domainEvidence, System.Type domainEvidenceType, System.Security.Policy.Evidence assemblyEvidence, System.Type assemblyEvidenceType) { throw null; }
public static System.IO.IsolatedStorage.IsolatedStorageFile GetStore(System.IO.IsolatedStorage.IsolatedStorageScope scope, System.Type applicationEvidenceType) { throw null; }
public static System.IO.IsolatedStorage.IsolatedStorageFile GetStore(System.IO.IsolatedStorage.IsolatedStorageScope scope, System.Type domainEvidenceType, System.Type assemblyEvidenceType) { throw null; }
public static System.IO.IsolatedStorage.IsolatedStorageFile GetUserStoreForApplication() { throw null; }
Expand Down Expand Up @@ -118,24 +111,30 @@ public partial class IsolatedStorageFileStream : System.IO.FileStream
public override bool CanRead { get { throw null; } }
public override bool CanSeek { get { throw null; } }
public override bool CanWrite { get { throw null; } }
// https://github.com/dotnet/corefx/issues/11127
// [System.ObsoleteAttribute("This property has been deprecated. Please use IsolatedStorageFileStream's SafeFileHandle property instead. http://go.microsoft.com/fwlink/?linkid=14202")]
// public override System.IntPtr Handle { [System.Security.SecurityCriticalAttribute]get { throw null; } }
// public override System.IntPtr Handle { get { throw null; } }
public override bool IsAsync { get { throw null; } }
public override long Length { get { throw null; } }
public override long Position { get { throw null; } set { } }
// public override Microsoft.Win32.SafeHandles.SafeFileHandle SafeFileHandle { [System.Security.SecurityCriticalAttribute]get { throw null; } }
public override Microsoft.Win32.SafeHandles.SafeFileHandle SafeFileHandle { get { throw null; } }

// https://github.com/dotnet/corefx/issues/11126
// public override System.IAsyncResult BeginRead(byte[] buffer, int offset, int numBytes, System.AsyncCallback userCallback, object stateObject) { throw null; }
// public override System.IAsyncResult BeginWrite(byte[] buffer, int offset, int numBytes, System.AsyncCallback userCallback, object stateObject) { throw null; }
protected override void Dispose(bool disposing) { }
// https://github.com/dotnet/corefx/issues/11126
// public override int EndRead(System.IAsyncResult asyncResult) { throw null; }
// public override void EndWrite(System.IAsyncResult asyncResult) { }
public override void Flush() { }
public override void Flush(bool flushToDisk) { }
// https://github.com/dotnet/corefx/issues/11128
// public override void Lock(long position, long length) { }
public override int Read(byte[] buffer, int offset, int count) { throw null; }
public override int ReadByte() { throw null; }
public override long Seek(long offset, System.IO.SeekOrigin origin) { throw null; }
public override void SetLength(long value) { }
// https://github.com/dotnet/corefx/issues/11128
// public override void Unlock(long position, long length) { }
public override void Write(byte[] buffer, int offset, int count) { }
public override void WriteByte(byte value) { }
Expand Down
10 changes: 10 additions & 0 deletions src/System.IO.IsolatedStorage/ref/System.IO.IsolatedStorage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,17 @@
<Compile Include="System.IO.IsolatedStorage.cs" />
</ItemGroup>
<ItemGroup>
<None Include="4.0\project.json" />
<None Include="4.0\System.IO.IsolatedStorage.depproj" />
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
<PackageDestination Include="ref/netstandard1.7">
<TargetFramework>netstandard1.7</TargetFramework>
</PackageDestination>
<PackageDestination Include="ref/uap10.1">
<TargetFramework>uap10.1</TargetFramework>
</PackageDestination>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
4 changes: 1 addition & 3 deletions src/System.IO.IsolatedStorage/src/ApiCompatBaseline.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
Compat issues with assembly System.IO.IsolatedStorage:
CannotAddAbstractMembers : Member 'System.IO.IsolatedStorage.IsolatedStorage.GetPermission(System.Security.PermissionSet)' is abstract in the implementation but is missing in the contract.
Total Issues: 1
Total Issues: 0
12 changes: 2 additions & 10 deletions src/System.IO.IsolatedStorage/src/System.IO.IsolatedStorage.builds
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,13 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<Project Include="System.IO.IsolatedStorage.csproj">
<OSGroup>Unix</OSGroup>
</Project>
<Project Include="System.IO.IsolatedStorage.csproj">
<OSGroup>Windows_NT</OSGroup>
</Project>
<Project Include="System.IO.IsolatedStorage.csproj" />
<Project Include="System.IO.IsolatedStorage.csproj">
<TargetGroup>net463</TargetGroup>
</Project>
<!--
Can't seem to pick up Assembly.GetEntryAssembly and .CodeBase
<Project Include="System.IO.IsolatedStorage.csproj">
<TargetGroup>uap101aot</TargetGroup>
<TargetGroup>uap101</TargetGroup>
</Project>
-->
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
</Project>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<Configuration Condition="'$(Configuration)'=='' and '$(TargetGroup)' == ''">Windows_Debug</Configuration>
<Configuration Condition="'$(Configuration)'=='' and '$(TargetGroup)' == ''"></Configuration>
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.IO.IsolatedStorage</AssemblyName>
<ProjectGuid>{FAF5D1E4-BA43-4663-8429-C069066D75CB}</ProjectGuid>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<EnableWinRT Condition="'$(TargetGroup)' == 'uap101aot'">true</EnableWinRT>
<EnableWinRT Condition="'$(TargetGroup)' == 'uap101'">true</EnableWinRT>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net463'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net463'">None</ResourcesSourceOutputDirectory>
<PackageTargetFramework Condition="'$(PackageTargetFramework)' == ''">netstandard1.7</PackageTargetFramework>
<NuGetTargetMoniker Condition="'$(TargetGroup)' == ''">.NETStandard,Version=v1.7</NuGetTargetMoniker>
<BaselineAllAPICompatError>true</BaselineAllAPICompatError>
</PropertyGroup>
<!-- Default configurations to help VS understand the options -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Unix_Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Unix_Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Windows_Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Windows_Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap101aot_Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap101aot_Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap101_Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap101_Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'net463_Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'net463_Release|AnyCPU'" />
<ItemGroup Condition="'$(EnableWinRT)' == 'true'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// See the LICENSE file in the project root for more information.


using System.Reflection;

namespace System.IO.IsolatedStorage
{
internal static partial class Helper
Expand Down Expand Up @@ -48,10 +50,43 @@ internal static void CreateDirectory(string path, IsolatedStorageScope scope)
}
else
{
// TODO:
// TODO: https://github.com/dotnet/corefx/issues/11124
// Machine scope, we need to ACL
throw new NotImplementedException();
}
}

internal static void GetDefaultIdentityAndHash(ref object identity, ref string hash, char separator)
{
// NetFX (desktop CLR) IsolatedStorage uses identity from System.Security.Policy.Evidence to build
// the folder structure on disk. It would use the "best" available evidence in this order:
//
// 1. Publisher (Authenticode)
// 2. StrongName
// 3. Url (CodeBase)
// 4. Site
// 5. Zone
//
// For CoreFx StrongName and Url are the only relevant types. By default evidence for the Domain comes
// from the Assembly which comes from the EntryAssembly(). We'll emulate the legacy default behavior
// by pulling directly from EntryAssembly.

Assembly assembly = Assembly.GetEntryAssembly();
AssemblyName assemblyName = assembly.GetName();
Uri codeBase = new Uri(assembly.CodeBase);

hash = GetNormalizedStrongNameHash(assemblyName);
if (hash != null)
{
hash = "StrongName" + separator + hash;
identity = assemblyName;
}
else
{
hash = GetNormalizedUriHash(codeBase);
hash = "Url" + separator + hash;
identity = codeBase;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using Windows.ApplicationModel;
using Windows.Storage;

namespace System.IO.IsolatedStorage
Expand All @@ -17,10 +19,7 @@ internal static string GetDataDirectory(IsolatedStorageScope scope)

if (IsMachine(scope))
{
// TODO:
// Windows 10 introduced a way to share across multiple users:
// dataDirectory = dataDirectory = ApplicationData.Current.SharedLocalFolder.Path;
throw new PlatformNotSupportedException();
dataDirectory = ApplicationData.Current.SharedLocalFolder.Path;
}
else
{
Expand All @@ -44,5 +43,25 @@ internal static void CreateDirectory(string path, IsolatedStorageScope scope)
// ACL'ing isn't an issue in WinRT, just create it
Directory.CreateDirectory(path);
}

internal static void GetDefaultIdentityAndHash(ref object identity, ref string hash, char separator)
{
// WinRT creates an ApplicationSecurityInfo off of the AppDomain.CurrentDomain.ActivationContext.
// Evidence is built as follows:
//
// StrongName <- ApplicationId.PublicKeyToken/Name/Version
// Url <- ApplicationContext.Identity.CodeBase
// Zone <- Zone.CreateFromUrl(Url)
// Site <- Site.CreateFromUrl(Url) *if* not file://

// TODO: https://github.com/dotnet/corefx/issues/11123
// When we have Assembly.GetEntryAssembly() we can utilize it to get the AssemblyName and
// Codebase to unify the logic. For now we'll use installed location from the package.
Uri codeBase = new Uri(Package.Current.InstalledLocation.Path);

hash = GetNormalizedUriHash(codeBase);
hash = "Url" + separator + hash;
identity = codeBase;
}
}
}
Loading

0 comments on commit afe6f68

Please sign in to comment.