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

System.Data.OleDB Error Messages not working on Spanish (Argentina) #108035

Open
Cristian-Rosa opened this issue Sep 19, 2024 · 7 comments
Open
Labels
area-System.Data.OleDB untriaged New issue has not been triaged by the area owner

Comments

@Cristian-Rosa
Copy link

Cristian-Rosa commented Sep 19, 2024

Description

After migrating from System.Data.OleDB 6.0.0 to 7.0.0 or greater error messages are broken on Windows with language set to Spanish Locale (Argentina). Instead it shows error codes.

Reproduction Steps

For example:
System.Data.OleDb.OleDbConnection cn = new System.Data.OleDb.OleDbConnection();
try
{
cn.ConnectionString = "Provider=SQLOLEDB.1;Data Source=AnyWrongDS;Integrated Security=SSPI;Initial Catalog=master;Current Language=Spanish;";
cn.Open();
}
catch (Exception ex)
{
Console.Write(ex.Message);
}

Expected behavior

Exception on version 7.0.0 or greater should throw: [DBNETLIB][ConnectionOpen (Connect()).]No existe el servidor SQL Server o se ha denegado el acceso al mismo

Actual behavior

Running the code on Windows with language set to English throws: [DBNETLIB][ConnectionOpen(Connect()).] SQL server does not exist or access denied
Running on Spanish language Locale (Argentina) throws: Unspecified error: E_FAIL(0x80004005)
Running on Spanish (Argentina) using System.Data.OleDB 6.0.0 throws: [DBNETLIB][ConnectionOpen (Connect()).]No existe el servidor SQL Server o se ha denegado el acceso al mismo

Regression?

No response

Known Workarounds

No response

Configuration

.Net 7.0.0 or greater
Windows language: Spanish

Other information

No response

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Sep 19, 2024
Copy link
Contributor

Tagging subscribers to this area: @DavoudEshtehari, @David-Engel, @JRahnama
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Tagging subscribers to this area: @roji, @ajcvickers
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Tagging subscribers to this area: @roji, @ajcvickers
See info in area-owners.md if you want to be subscribed.

@Cristian-Rosa
Copy link
Author

Cristian-Rosa commented Sep 20, 2024

Changed original post. Issue is related only with Spanish (Argentina) locale.

Issue start with 7.0.0-preview.1.22076.8
I think could be related to #61184

@Cristian-Rosa Cristian-Rosa changed the title System.Data.OleDB Error Messages not working on Spanish System.Data.OleDB Error Messages not working on Spanish (Argentina) Sep 20, 2024
@roji
Copy link
Member

roji commented Sep 20, 2024

@AaronRobinsonMSFT @jkoritzinsky @elinor-fung does it sound like #61184 could trigger this?

@Cristian-Rosa
Copy link
Author

Debugged until OleDbComWrappers.GetDescription

public unsafe System.Data.OleDb.OleDbHResult GetDescription(out string? description)
{
IntPtr pDescription = IntPtr.Zero;
int errorCode = ((delegate* unmanaged<IntPtr, IntPtr*, int>)(*(*(void***)_wrappedInstance + 5 /* IErrorInfo.GetDescription slot */))) (_wrappedInstance, &pDescription);

errorCode is taking -2147217855 value

@jkoritzinsky
Copy link
Member

That error code is DB_E_NOLOCALE.

It's possible that the conversion to source-generated P/Invokes missed something. I'll take a quick look and see if I can find something that we missed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Data.OleDB untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

4 participants