opendal: Dotnet binding fails on windows
Dotnet binding fails on windows, and passed on linux with net8
→ dotnet test .\DotOpenDAL.Tests\
Determining projects to restore...
All projects are up-to-date for restore.
DotOpenDAL -> \opendal\incubator-opendal\bindings\dotnet\DotOpenDAL\bin\Debug\net8.0\DotOpenDAL.dll
DotOpenDAL.Tests -> \opendal\incubator-opendal\bindings\dotnet\DotOpenDAL.Tests\bin\Debug\net8.0\DotOpenD
AL.Tests.dll
Test run for \opendal\incubator-opendal\bindings\dotnet\DotOpenDAL.Tests\bin\Debug\net8.0\DotOpenDAL.Tests.dll (.NETCoreApp,Version=v8.0)
Microsoft (R) Test Execution Command Line Tool Version 17.8.0 (x64)
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.32] DotOpenDAL.Tests.BlockingOperatorTest.TestReadWrite [FAIL]
Failed DotOpenDAL.Tests.BlockingOperatorTest.TestReadWrite [72 ms]
Error Message:
Assert.NotEqual() Failure
Expected: Not 0
Actual: 0
Stack Trace:
at DotOpenDAL.Tests.BlockingOperatorTest.TestReadWrite() in \opendal\incubator-opendal\bindings\dotnet\DotOpenDAL.Tests\BlockingOperatorTest.cs:line 29
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
Failed! - Failed: 1, Passed: 0, Skipped: 0, Total: 1, Duration: < 1 ms - DotOpenDAL.Tests.dll (net8.0)
When passing a C# string to c_char, it’s UTF16 internal on windows, and then fail to parse in rust part
About this issue
- Original URL
- State: open
- Created 6 months ago
- Comments: 17 (13 by maintainers)
If we want to keep the same behavior for both windows and linux, we need to use ‘Marshal.StringToCoTaskMemUTF8’ manually. It’s the recommended way from official.
I think the UTF8 here is enough for .NET binding. Here’s the reason:
The core problem here is that we don’t have a dot net binding SDK here. So we need to process the DLL call convension. We can take the JNI binding sdk as a example
So for me ,the UTF8 LGTM
Apologize, the Chinese character does work as I passed it to a wrong place.