Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[csharp] Fix error loading library grpc_csharp_ext.*.dll on windows with non-ASCII encoding #26762

Merged
merged 3 commits into from
Sep 3, 2021

Conversation

trs4
Copy link
Contributor

@trs4 trs4 commented Jul 22, 2021

Fix error loading library grpc_csharp_ext.x64.dll on desktop Windows application with charset on non ANSI encoding. Example library path: C:\тест\grpc_csharp_ext.x64.dll

  • Added handle of the win error code that occurred

lang/csharp
.NET Framework 4.7.2

@nicolasnoble

…Windows with charset on non ANSI encoding. Example library path: C:\Program Files (x86)\тест\grpc_csharp_ext.x64.dll
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jul 22, 2021

CLA Signed

The committers are authorized under a signed CLA.

@trs4 trs4 marked this pull request as draft July 22, 2021 21:13
@trs4 trs4 marked this pull request as ready for review July 22, 2021 21:22
@jtattermusch jtattermusch added lang/C# release notes: yes Indicates if PR needs to be in release notes labels Aug 27, 2021
@jtattermusch jtattermusch self-requested a review August 27, 2021 07:37
@jtattermusch jtattermusch changed the title [csharp] Fix error loading library grpc_csharp_ext.x64.dll [csharp] Fix error loading library grpc_csharp_ext.*.dll on windows with non-ASCII encoding Aug 27, 2021
Copy link
Contributor

@jtattermusch jtattermusch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once all the tests pass.

@jtattermusch
Copy link
Contributor

jtattermusch commented Aug 27, 2021

@apolcyn can you please add another LGTM?

string.Join(",", libraryPathAlternatives)));
}

private static class Windows
{
[DllImport("kernel32.dll")]
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Net Standard not supported CharSet.Auto, CharSet.Unicode supported all .net versions
https://docs.microsoft.com/ru-ru/dotnet/api/system.runtime.interopservices.charset?view=netstandard-1.6

@trs4
Copy link
Contributor Author

trs4 commented Aug 27, 2021

Is there anything else i need to do, to complete my first pull request to merge? Sorry for my english

@jtattermusch
Copy link
Contributor

Is there anything else i need to do, to complete my first pull request to merge? Sorry for my english

Nothing is needed from you, we're just running some tests and if they all look good, we'll merge.

@jtattermusch
Copy link
Contributor

Getting a good run of the macos artifact build is proving difficult and without that it's not possible to get a good distribtest run. I'm going to merge and check that distribtests are green afterwards.

@jtattermusch jtattermusch merged commit 4a26766 into grpc:master Sep 3, 2021
Copy link
Contributor

@gnossen gnossen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@copybara-service copybara-service bot added the imported Specifies if the PR has been imported to the internal repository label Sep 3, 2021
@jtattermusch
Copy link
Contributor

FTR I checked the distribtests results after merging and everything seemed green.

lidizheng pushed a commit to lidizheng/grpc that referenced this pull request Sep 23, 2021
…ith non-ASCII encoding (grpc#26762)

* [csharp net472] Fix error loading library grpc_csharp_ext.x64.dll on Windows with charset on non ANSI encoding. Example library path: C:\Program Files (x86)\тест\grpc_csharp_ext.x64.dll

* cleanup

* Change charset to Unicode

Co-authored-by: Jan Tattermusch <jtattermusch@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imported Specifies if the PR has been imported to the internal repository lang/C# release notes: yes Indicates if PR needs to be in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants