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

.Net Maui Microsoft.Data.SqlClient, works on Windows NOT Android(Value cannot be null. (Parameter 'source') #7277

Closed
vsfeedback opened this issue Aug 17, 2022 · 2 comments

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


[severity:I'm unable to use this version]
Microsoft Visual Studio Community 2022 (64-bit) - Preview
Version 17.3.0 Preview 6.0
.Net Maui Standard Template

	string connStr = @$"Server=MyserverIP\SQLEXPRESS;Database=MyDB;Integrated Security=false[Redacted]Encrypt=false";
        using var db = new SqlConnection(connStr);
	try
	{
            db.Open();
        }
	catch (Exception ex)
	{
	   Console.WriteLine(ex.Message);
           // ex = Value cannot be null. (Parameter 'source)
	}

Far better example/Test:
https://github.com/janseris/MAUI_SQLServer_Test

Using MAUI_SQLServer_Test, choose custom string and use similar to mine above.
Windows: All pass
Android: All fail with Value cannot be null. (Parameter 'source)


Original Comments

Feedback Bot on 8/9/2022, 01:15 AM:

(private comment, text removed)


Original Solutions

(no solutions)

@jonpryor
Copy link
Member

Instead of printing Exception.Message, please use Excecption.ToString(). That would help in pinpointing where the null argument exception is coming from.

Additionally, it looks like Microsoft.Data.SqlClient may not fully support Android yet:

This is thus presumably a bug in the Microsoft.Data.SqlClient package and not a package in .NET SDK for Android.

@janseris
Copy link

janseris commented Aug 22, 2022

@jonpryor are you sure this is SqlClient problem and not MAUI/Xamarin problem? MAUI has this type of SSL/TLS issues in various technologies such as gRPC, WebSocket and SQL Server

Edit: SMTP as well

With the issues you mentioned and I created, the only issue is in a SSL handshake which happens during SQL Server login attempt (regardless of Encrypt true/false parameter in connection string because that only affects data encryption)
When I google accessing SQL Server from Xamarin, I still get the same issues over and over.

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

No branches or pull requests

3 participants