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

Microsoft.Data.SqlClient is not supported on this platform #191

Closed
gaelazzo opened this issue Feb 14, 2024 · 8 comments
Closed

Microsoft.Data.SqlClient is not supported on this platform #191

gaelazzo opened this issue Feb 14, 2024 · 8 comments

Comments

@gaelazzo
Copy link

I modified the sample edge-js-quick-start to add Microsoft.Data.SqlClient (and I tried System.Data.SqlClient as well) trying to establish a SqlConnection, but I get the exception:

Microsoft.Data.SqlClient is not supported on this platform.
at Microsoft.Data.SqlClient.SqlConnection..ctor(String connectionString) in /_/artifacts/Project/obj/Release.AnyCPU/Microsoft.Data.SqlClient/netcore/net6.0/Microsoft.Data.SqlClient.notsupported.cs:line 422

My repository is edge-js-quick-start-sqlclient.

I've explored various avenues to resolve the issue, including modifying edge-js as well. However, I'm still unable to find a solution.
Given the complexity of the problem and its impact on my work, I'm open to offering compensation for assistance in resolving this issue. I believe your expertise and insights could greatly contribute to finding a solution.

If you're available and willing to help, I'd greatly appreciate your assistance. Please let me know if you're interested, and we can discuss the details, including the compensation amount, further.

Thank you for considering my request.

Best regards,
Gaetano Lazzo

@agracio
Copy link
Owner

agracio commented Feb 14, 2024

Does that happen on windows?

@gaelazzo
Copy link
Author

Yes It does.

@agracio
Copy link
Owner

agracio commented Feb 14, 2024

In QuickStart.Core.csproj add the following references:

    <PackageReference Include="System.Collections" Version="4.3.0" />
    <PackageReference Include="System.IO" Version="4.3.0" />
    <PackageReference Include="System.IO.FileSystem" Version="4.3.0" />

Build then run dotnet publish src/QuickStart.Core/QuickStart.Core.csproj -c Release -r win-x64

in main.js replace

const baseNetAppPath = path.join(__dirname, '/src/'+ namespace +'/bin/Debug/net'+ net + version);

with

const baseNetAppPath = path.join(__dirname, '/src/'+ namespace +'/bin/Release/net'+ net + version + '/win-x64');

@gaelazzo
Copy link
Author

gaelazzo commented Feb 15, 2024

Ok now I have another error:
Error: A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - Catena di certificati emessa da una Autorità di certificazione non disponibile nell'elenco locale.)
So at least it solved that one. Now I have to solve this new one.
But I want my project to be runnable also under Linux, so will I have to make different builds one for each target platform?

Note
I'm open to compensating you for your time and expertise, as I'm eager to overcome these obstacles and make progress with the project.
Additionally, if you're willing to assist, could you please let me know the best way to contact you?

@gaelazzo
Copy link
Author

I added ;TrustServerCertificate=true to the connection string and some little fixes on the sql command and I solved the error I was encountering.
Many thanks

@agracio
Copy link
Owner

agracio commented Feb 15, 2024

For different platform builds you need to specify correct dotnet publish -r <RID> although I am not sure you can publish for Linux using Windows you might need to build and publish separately on each platform.

@gaelazzo
Copy link
Author

Many thanks !

@agracio
Copy link
Owner

agracio commented May 4, 2024

Quick update: this issue does not appear to be present when using the latest release of Edge.js and System.Data.SqlClient instead of Microsoft.Data.SqlClient in your repo.
However when using Microsoft.Data.SqlClient it does not work at all with C# code behaving erratically without showing any issues in Edge.js. I tried to investigate but nothing is making sense especially since Edge.js code executes as expected.

If you are upgrading to latest version of Edge.js note the change in EdgeJs.dll location as it it now .net version agnostic to simplify any future changes. node_modules/edge-js/lib/bootstrap/bin/Release/EdgeJs.dll

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants