Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/installer/tests/AppHost.Bundle.Tests/AppLaunch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,34 @@ private void RunApp(bool selfContained)
}
}

[Fact]
private void NonAsciiCharacterSelfContainedApp()
{
// Bundle to a single-file
bool selfContained = true;
string singleFile = sharedTestState.SpecialCharacterSelfContainedApp.Bundle();

// Run the bundled app
RunTheApp(singleFile, selfContained);

if (OperatingSystem.IsMacOS())
{
string fatApp = MakeUniversalBinary(singleFile, RuntimeInformation.OSArchitecture);

// Run the fat app
RunTheApp(fatApp, selfContained);
}

if (OperatingSystem.IsWindows())
{
// StandaloneApp sets FileVersion to NETCoreApp version. On Windows, this should be copied to singlefilehost resources.
string expectedVersion = TestContext.MicrosoftNETCoreAppVersion.Contains('-')
? TestContext.MicrosoftNETCoreAppVersion[..TestContext.MicrosoftNETCoreAppVersion.IndexOf('-')]
: TestContext.MicrosoftNETCoreAppVersion;
Assert.Equal(expectedVersion, System.Diagnostics.FileVersionInfo.GetVersionInfo(singleFile).FileVersion);
}
}

[ConditionalTheory(typeof(Binaries.CetCompat), nameof(Binaries.CetCompat.IsSupported))]
[InlineData(true)]
[InlineData(false)]
Expand Down Expand Up @@ -186,17 +214,20 @@ public class SharedTestState : IDisposable
{
public SingleFileTestApp FrameworkDependentApp { get; }
public SingleFileTestApp SelfContainedApp { get; }
public SingleFileTestApp SpecialCharacterSelfContainedApp { get; }

public SharedTestState()
{
FrameworkDependentApp = SingleFileTestApp.CreateFrameworkDependent("HelloWorld");
SelfContainedApp = SingleFileTestApp.CreateSelfContained("HelloWorld");
SpecialCharacterSelfContainedApp = SingleFileTestApp.CreateSelfContained("HelloWorld_中文");
}

public void Dispose()
{
FrameworkDependentApp.Dispose();
SelfContainedApp.Dispose();
SpecialCharacterSelfContainedApp.Dispose();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>

<!-- FileVersion always gets set for projects in this repo by _InitializeAssemblyVersion. Update the file version afterwards. -->
<Target Name="SetFileVersion" AfterTargets="_InitializeAssemblyVersion">
<PropertyGroup>
<FileVersion>$(ProductVersion)</FileVersion>
</PropertyGroup>
</Target>

<ItemGroup>
<Compile Include="..\CoreDump.cs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,29 @@ public void DuplicateBundleRelativePath_Fails()
.And.Contain(sharedTestState.App.AppDll);
}

[Fact]
public void FilesWithNonAsciiCharsCanBundle()
{
string appPath = sharedTestState.NonAsciiApp.AppDll;
string systemLibPath = sharedTestState.SystemDll;

// File specification with non-ASCII characters in the relative paths
var fileSpecs = new FileSpec[]
{
new FileSpec(Binaries.AppHost.FilePath, BundlerHostName),
new FileSpec(appPath, "中文/app.dll"),
new FileSpec(appPath, "rel/中文.dll"),
new FileSpec(systemLibPath, "中文")
};

Bundler bundler = CreateBundlerInstance();
var bundlePath = bundler.GenerateBundle(fileSpecs);
Comment thread
jtschuster marked this conversation as resolved.

bundler.BundleManifest.Files.Where(entry => entry.RelativePath.Equals("中文/app.dll")).Single().Type.Should().Be(FileType.Assembly);
bundler.BundleManifest.Files.Where(entry => entry.RelativePath.Equals("rel/中文.dll")).Single().Type.Should().Be(FileType.Assembly);
bundler.BundleManifest.Files.Where(entry => entry.RelativePath.Equals("中文")).Single().Type.Should().Be(FileType.Assembly);
}

[Fact]
public void CaseSensitiveBundleRelativePath()
{
Expand Down Expand Up @@ -366,18 +389,21 @@ public class SharedTestState : IDisposable
{
public const string AppName = "HelloWorld";
public TestApp App { get; }
public TestApp NonAsciiApp { get; }
public string SystemDll { get; }

public SharedTestState()
{
App = TestApp.CreateFromBuiltAssets(AppName);
NonAsciiApp = TestApp.CreateFromBuiltAssets("HelloWorld_中文");

SystemDll = Path.Combine(TestContext.BuiltDotNet.GreatestVersionSharedFxPath, "System.dll");
}

public void Dispose()
{
App.Dispose();
NonAsciiApp.Dispose();
}
}
}
Expand Down