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

[OLEDB] Text file created in US locale not readable on others as delimited file #29969

Closed
maryamariyan opened this issue Jun 20, 2019 · 7 comments

Comments

@maryamariyan
Copy link
Member

Found this issue while running OLEDB outerloop tests on the CI machines with Spanish locale. (Initially reported in PR dotnet/corefx#38024)

The failure seems to be in Spanish SKU of Windows: where a text file created in US locale cannot be read on other computers as a delimited file. (For more info check here)

cc: @tarekgh @saurabh500

@maryamariyan
Copy link
Member Author

maryamariyan commented Jun 20, 2019

+ using System.Globalization;

        [OuterLoop]
        [ConditionalFact(Helpers.IsDriverAvailable)]
        public void DeriveParameters_NullConnection_Throws()
        {
+            Assert.True(CultureInfo.CurrentCulture.Name.Equals("en-US", StringComparison.OrdinalIgnoreCase));
+            CultureInfo.CurrentCulture = new CultureInfo("es-ES");
+            Assert.True(CultureInfo.CurrentCulture.Name.Equals("es-ES", StringComparison.OrdinalIgnoreCase));
            RunTest((command, tableName) => {
                using (var cmd = (OleDbCommand)OleDbFactory.Instance.CreateCommand())
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = @"SELECT * FROM " + tableName;  
                    cmd.Connection = null;
                    
                    AssertExtensions.Throws<InvalidOperationException>(
                        () => OleDbCommandBuilder.DeriveParameters(cmd), 
                        $"{nameof(OleDbCommandBuilder.DeriveParameters)}: {nameof(cmd.Connection)} property has not been initialized.");
                }
            });
        }

I tweaked one of the failing tests locally to just run the test with spanish locale, and I still get the test pass successfully for myself locally meanwhile the same tests was failing on the CI with following message: (Refer to here)

Unhandled Exception of Type System.Data.OleDb.OleDbException
Message :
System.Data.OleDb.OleDbException : Text file specification field separator matches decimal separator or text delimiter.
Stack Trace :
   at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) in /_/src/System.Data.OleDb/src/OleDbCommand.cs:line 893
   at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) in /_/src/System.Data.OleDb/src/OleDbCommand.cs:line 857
   at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) in /_/src/System.Data.OleDb/src/OleDbCommand.cs:line 812
   at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) in /_/src/System.Data.OleDb/src/OleDbCommand.cs:line 771
   at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) in /_/src/System.Data.OleDb/src/OleDbCommand.cs:line 622
   at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() in /_/src/System.Data.OleDb/src/OleDbCommand.cs:line 916
   at System.Data.OleDb.Tests.OleDbCommandBuilderTests.RunTest(Action`2 testAction, String memberName) in /_/src/System.Data.OleDb/tests/OleDbCommandBuilderTests.cs:line 161
   at System.Data.OleDb.Tests.OleDbCommandBuilderTests.DeriveParameters_NullConnection_Throws() in /_/src/System.Data.OleDb/tests/OleDbCommandBuilderTests.cs:line 53

Making this change didn't give me a local repro.

@tarekgh
Copy link
Member

tarekgh commented Jun 20, 2019

@maryamariyan could you try move the lines

            Assert.True(CultureInfo.CurrentCulture.Name.Equals("en-US", StringComparison.OrdinalIgnoreCase));
            CultureInfo.CurrentCulture = new CultureInfo("es-ES");
            Assert.True(CultureInfo.CurrentCulture.Name.Equals("es-ES", StringComparison.OrdinalIgnoreCase));

inside the RunTest passed delegate?

@maryamariyan
Copy link
Member Author

maryamariyan commented Jun 20, 2019

I moved the assertions also inside RunTest and around the ExecuteNonQuery call shown in the above call stack. It didn't seem to produce a repro.

cc: @saurabh500

@saurabh500
Copy link
Contributor

@maryamariyan The changes you made above for a repro, only changes the locale for C# test DeriveParameters_NullConnection_Throws right ?
The error I believe should recur in case the Locale of the OS is changed to spanish. This error is coming from the OleDb layer which is simply being surfaced from OleDb provider.
Hence the OleDb driver would have to operate in the spanish locale.

@saurabh500
Copy link
Contributor

Did you change the locale of the OS as well ?

@maryamariyan
Copy link
Member Author

maryamariyan commented Jun 20, 2019

I changed the region locale to (Spanish - Spain). I'll see if there's more settings I need to change to get this repro.


UPDATE:
Got repro by making change below:

  • Start > Region Settings > Regional Format > Change English to Spanish

It wasn't the system locale, since changing the locale below doesn't cause that repro:

  • Start > Region Settings > Additional date, time, and regional settings > Region > Administrative (tab) > change system locale

@maryamariyan maryamariyan reopened this Aug 16, 2019
@msftgits msftgits transferred this issue from dotnet/corefx Feb 1, 2020
@msftgits msftgits added this to the Future milestone Feb 1, 2020
@maryamariyan maryamariyan added the untriaged New issue has not been triaged by the area owner label Feb 23, 2020
@ajcvickers ajcvickers removed the untriaged New issue has not been triaged by the area owner label Jun 23, 2020
@ajcvickers
Copy link
Member

Closing as this is not something we plan to fix.

@ajcvickers ajcvickers removed this from the Future milestone Jun 23, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants