Imported Upstream version 5.10.0.69

Former-commit-id: fc39669a0b707dd3c063977486506b6793da2890
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-29 19:03:06 +00:00
parent d8f8abd549
commit e2950ec768
6283 changed files with 453847 additions and 91879 deletions

View File

@@ -13,6 +13,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
<ProjectReference Include="..\..\System.Runtime.Extensions\ref\System.Runtime.Extensions.csproj" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -60,6 +60,7 @@
<Reference Include="System.IO.FileSystem" />
<Reference Include="System.Resources.ResourceManager" />
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.Extensions" />
<Reference Include="System.Runtime.InteropServices" />
</ItemGroup>
<ItemGroup Condition="'$(TargetsUnix)' == 'true' OR '$(TargetGroup)' == 'uap'">

View File

@@ -265,6 +265,12 @@ namespace System.Diagnostics
/// </summary>
public static FileVersionInfo GetVersionInfo(string fileName)
{
// Check if fileName is a full path. Relative paths can cause confusion if the local file has the .dll extension,
// as .dll search paths can take over & look for system .dll's in that case.
if (!Path.IsPathFullyQualified(fileName))
{
fileName = Path.GetFullPath(fileName);
}
// Check for the existence of the file. File.Exists returns false if Read permission is denied.
if (!File.Exists(fileName))
{

View File

@@ -9,7 +9,6 @@
<ProjectGuid>{28EB14BE-3BC9-4543-ABA6-A932424DFBD0}</ProjectGuid>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<!-- Compiled Source Files -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />

View File

@@ -102,6 +102,26 @@ namespace System.Diagnostics.Tests
FileVersionInfo.GetVersionInfo(Path.Combine(Directory.GetCurrentDirectory(), TestNotFoundFileName)));
}
[Fact]
[SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "Don't want to create temp file in app container current directory")]
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "NetFX throws ArgumentException in this case")]
public void FileVersionInfo_RelativePath_CorrectFilePath()
{
try
{
File.WriteAllText("kernelbase.dll", "bogus kernelbase.dll");
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo("kernelbase.dll");
// File name should be the full path to the local kernelbase.dll, not the relative path or the path to the system .dll
Assert.Equal(Path.GetFullPath("kernelbase.dll"), fvi.FileName);
// FileDescription should be null in the local kernelbase.dll
Assert.Equal(null, fvi.FileDescription);
}
finally
{
File.Delete("kernelbase.dll");
}
}
// Additional Tests Wanted:
// [] File exists but we don't have permission to read it
// [] DLL has unknown codepage info

View File

@@ -5,7 +5,6 @@
<AssemblyName>System.Diagnostics.FileVersionInfo.Tests</AssemblyName>
<ProjectGuid>{6DFDB760-CC88-48AE-BD81-C64844EA3CBC}</ProjectGuid>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Unix-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Unix-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Windows_NT-Debug|AnyCPU'" />
@@ -48,7 +47,6 @@
</ProjectReference>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<PropertyGroup>
<BuildDependsOn>$(BuildDependsOn);MangleTestAssemblyExtension</BuildDependsOn>
</PropertyGroup>
@@ -56,5 +54,4 @@
<!-- Copy TestAssembly to file without .dll extension so that ILC preserves it as a data file rather than feeding it to the output executable. -->
<Copy SourceFiles="$(TestPath)\System.Diagnostics.FileVersionInfo.TestAssembly.dll" DestinationFiles="$(TestPath)\System.Diagnostics.FileVersionInfo.TestAssembly.ildll" />
</Target>
</Project>
</Project>