grpc / grpc

The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#)
https://grpc.io
Apache License 2.0
41.68k stars 10.5k forks source link

Error "Failed to open argument file" when building .NET gRPC client #36518

Open bhaeussermann opened 4 months ago

bhaeussermann commented 4 months ago

What version of gRPC and what language are you using?

Language: C#

What operating system (Linux, Windows,...) and version?

Windows 11 Enterprise (10.0.22631 Build 22631)

What runtime / compiler are you using (e.g. python version or version of gcc)

.NET 8.0.204

What did you do?

I followed the steps in the Microsoft tutorial for creating a .NET gRPC client. When I build the project as per the step Create the Greeter client the build fails.

When I change the Grpc.Tools package version to 2.62.0 the build does work.

What did you expect to see?

Building the project should work when using the latest version of the Grpc.Tools package 2.63.0

What did you see instead?

Building the project fails when using Grpc.Tools version 2.63.0. Here's the output of my dotnet build command:

Build FAILED.

Failed to open argument file : error : C:\Users\BernhardHΣussermann\AppData\Local\Temp\MSBuildTemp\tmpf125472c380a4dbb91717d0291dfeff7.rsp [C:\Project
s\AdHoc\GrpcClient\GrpcClient.csproj]

Anything else we should know about your project / environment?

My Windows user name "BernhardHäussermann" contains diacriticals. Could this be triggering the error?

kimjamia commented 4 months ago

I have the exact same issue and my Windows username also includes the letter "ä" which shows up as "Σ" in the output window in Visual Studio.

Steps to reproduce:

  1. Have your Windows user folder include the letter "ä", e.g. "C:\Users\KimJämiä\".
  2. Create a new solution: dotnet new sln -n ProtoTest.
  3. Create a new project: dotnet new classlib -n ProtoTest.Shared.
  4. Include the project in the solution: dotnet sln .\ProtoTest.sln add .\ProtoTest.Shared\.
  5. CD into the project dir and install grpc packages:
    dotnet add package Grpc.Net.Client
    dotnet add package Grpc.Tools
    dotnet add package Google.Protobuf
    dotnet add package Grpc.Net.ClientFactory
  6. In the project dir, add a folder "Protos" and add the sample proto file that Visual Studio also creates if you create an ASP.NET Core gRPC Service" project:
    
    syntax = "proto3";

option csharp_namespace = "GrpcService1";

package greet;

// The greeting service definition. service Greeter { // Sends a greeting rpc SayHello (HelloRequest) returns (HelloReply); }

// The request message containing the user's name. message HelloRequest { string name = 1; }

// The response message containing the greetings. message HelloReply { string message = 1; }


7. Change the "Build Action" of the .proto file you just created to "Protobuf compiler".
8. Build the project.
9. => Observe error: `Failed to open argument file : error : C:\Users\KimJΣmiΣ\AppData\Local\Temp\tmpf16635cd18a6408296b3118b3c9ed080.rsp`

A similar issue was happening before on ticket #17995

Possible other related issues:
* https://github.com/protocolbuffers/protobuf/issues/6715
* https://github.com/protocolbuffers/protobuf/issues/7474
tonydnewell commented 3 months ago

There is a regression in the protocol buffers compiler that ships with Grpc.Tools V2.63.0 onwards. I think this is caused by the "fix" https://github.com/protocolbuffers/protobuf/pull/14253

V2.62.0 ships with protoc version 25.1 V2.63. ships with protoc version 26.1

tonydnewell commented 3 months ago

I've opened an issue with protocol buffers: https://github.com/protocolbuffers/protobuf/issues/17036

kerojiang commented 2 months ago

I have got the same problem,my windows username use the chinese character。 This is error message: C:\Users\ND-江杰\AppData\Local\Temp\tmp0eba17d8ace54f06926e76e1v3d7e4de.rsp Failed to open argument file.

Grpc.Tools v2.65

tonydnewell commented 2 months ago

I have got the same problem,my windows username use the chinese character。 This is error message: C:\Users\ND-江杰\AppData\Local\Temp\tmp0eba17d8ace54f06926e76e1v3d7e4de.rsp Failed to open argument file.

Grpc.Tools v2.65

There is a fix to protoc that is in progress - it might take a while to get into a new Grpc.Tools package. In the meantime you can safely revert to using Grpc.Tools 2.62.

kerojiang commented 2 months ago

I have got the same problem,my windows username use the chinese character。 This is error message: C:\Users\ND-江杰\AppData\Local\Temp\tmp0eba17d8ace54f06926e76e1v3d7e4de.rsp Failed to open argument file. Grpc.Tools v2.65

There is a fix to protoc that is in progress - it might take a while to get into a new Grpc.Tools package. In the meantime you can safely revert to using Grpc.Tools 2.62.

thanks

TopSwagCode commented 1 month ago

Denmark here also having issues: C:\Users\JoshuaJesperKrµgp°th

magnusj64 commented 1 month ago

Sweden as well:

Severity Code Description Project File Line Suppression State Error (active) C:\Users\MagnusJungÕker\AppData\Local\Temp\tmpf807104d298b43b8850809ee0d41ac8c.rsp GrpcGreeterClient C:\Users\MagnusJungåker\source\repos\GrpcGreeterClient\GrpcGreeterClient\Failed to open argument file 1

tonydnewell commented 1 month ago

I've found the bad merge in protocol buffers repository and submitted a fix: https://github.com/protocolbuffers/protobuf/pull/17854

There was a line missing from a PR that tried to fix utf8 command line arguments. This broke reading the command line arguments from a file (which is how Grpc.Tools calls protoc) when the path to the file had non-ascii characters.

apolcyn commented 2 days ago

Note to self: this can be closed after we update this repo's protobuf dep to include https://github.com/protocolbuffers/protobuf/pull/17854, and then release a new grpc.tools