Skip to content

Access Exception thrown on exit after opening OleDb connection to access database #76712

Open

Description

Description

We're having an issue where our .Net 6 WinForms application will not exit after we open a connection to an Access database due to an exception being thrown outside of our code. I've been able to recreate the same fault with the code below. No exception is thrown during running, only when the application is exiting. Even more strangely is that we run into this even if the Access database specified in the connection string doesn't exist. What seems to be happening is that an access violation exception is thrown on exit, the application tries to exit, and then another exception is thrown which is causing an endless loop.

accessexception1

Reproduction Steps

Create a .Net 6 console application and use the following for the main body

        var connStr = "Provider=Microsoft.ACE.OLEDB.16.0;Data Source=c:\tfs\testdb.accdb;Persist Security Info=False";
        using (var testConn = new System.Data.OleDb.OleDbConnection(connStr))
        {
            try
            {
                testConn.Open();
                testConn.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }

Expected behavior

Application exits without error

Actual behavior

Application hangs on exit using 100% of a CPU core.

Regression?

This works without error in .Net Framework 4.8

Known Workarounds

No response

Configuration

.Net 6, Windows 10 Business 21H2. Office version installed is Microsoft 365 MSO (Version 2209 Build 16.0.15629.20152) 64-bit

Other information

We have seen this behavior across multiple different machines and have tried many different versions of the access runtimes without any change in behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions