Skip to content

Adding EntityFrameworkCore.SqlServer 9.0.1 breaks System.Windows.Forms #35538

@andrewwong0893

Description

@andrewwong0893

Bug description

I am upgrading from dotnet 8 to dotnet 9 on a WPF application.

Updating the framework works perfectly fine, but when it comes to updating the nuget package, all instances of System.Windows.Forms suddenly stopped working. MessageBoxButtons, FolderBrowserDialog, Cursor.Position no longer works.
When I revert the EF package back to version 8, the problem goes away.

Testing with EFCore.Sqlite works perfectly fine

Your code

var currentScreen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);

// -------------------------------------------------------------------------------------

var filePath = string.Empty;
var dialog = new FolderBrowserDialog();

if (dialog.ShowDialog() == DialogResult.OK)
{
    filePath = dialog.SelectedPath;
}

//-----------------------------------------------------------------------------
var result = MessageBox.Show("Message",
                             "Title",
                             MessageBoxButtons.RetryCancel,
                             MessageBoxIcon.Exclamation,
                             MessageBoxDefaultButton.Button1);

if (result != DialogResult.Retry)
{
    //...
}

Stack traces


Verbose output


EF Core version

9.0.1

Database provider

Microsoft.EntityFrameworkCore.SqlServer

Target framework

.NET 9.0

Operating system

Windows 11

IDE

VS Pro 17.12.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions