-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
dotnet/runtime
#34746Labels
Description
From @dmarchant on Wednesday, February 19, 2020 12:44:25 PM
System.IO.Path.GetFileName(<FullFilePath>) and new System.IO.DirectoryInfo(<FullFilePath>).Name do not work the same in client-side Blazor wasm as they do in server-side C#. In Blazor wasm it just returns back the same full path that you sent it. It doesn't extract the file name from the full path.
Environment
dotnet sdk: version 3.1.100 commit cd82f021f4
Blazor: 3.2.0-preview1.20073.1
To Reproduce
Create a new client-side asp.net core hosted blazor wasm project
dotnet new -i Microsoft.AspNetCore.Blazor.Templates::3.2.0-preview1.20073.1
dotnet new blazor wasm -ho
Add the following lines to the Program.cs of both the Project.Server and Project.Client
Console.WriteLine(System.IO.Path.GetFileName(@"C:\FakePath\File1.txt"));
Console.WriteLine(new System.IO.DirectoryInfo(@"C:\FakePath\File1.txt").Name);Execute the project. The Project.Server will output
File1.txt
File1.txt
The Project.Client will output
WASM: C:\FakePath\File1.txt
WASM: C:\FakePath\File1.txt
Copied from original issue: dotnet/aspnetcore#19141