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

HasName() throws System.StackOverflowException #21734

Closed
HSchwichtenberg opened this issue Jul 22, 2020 · 3 comments
Closed

HasName() throws System.StackOverflowException #21734

HSchwichtenberg opened this issue Jul 22, 2020 · 3 comments
Labels
area-model-building closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Milestone

Comments

@HSchwichtenberg
Copy link

HSchwichtenberg commented Jul 22, 2020

HasName() is marked "obsolete", but should not result in

System.StackOverflowException
HResult=0x800703E9
Message=Exception of type 'System.StackOverflowException' was thrown.

Steps to reproduce

protected override void OnModelCreating(ModelBuilder mb)
{
mb.Entity().HasIndex(x => x.FreeSeats).HasName("Index_FreeSeats");
}

Not happening if I use HasDatabaseName()

Further technical details

EF Core version: 5.0 Preview 7
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 5.0 Preview 6 und 7
Operating system: Windows 10
IDE: Visual Studio 2019 16.6

@Saibamen
Copy link

Saibamen commented Jul 22, 2020

This stack overflow comes after add-migration xxx?

I wanted to upgrade preview 6 to 7, but I got Stack overflow after add-migration in preview 7...

BTW I didn't have any obsolete mark for HasName() in my configurations while I was in preview 7

@ajcvickers
Copy link
Member

@dotnet/efcore This is a bad obsoletion; see below. Do we think this impact many existing migrations? If so we might want to fix it for preview 8.

[Obsolete("Use HasDatabaseName() instead.")]
public static IndexBuilder<TEntity> HasName<TEntity>([NotNull] this IndexBuilder<TEntity> indexBuilder, [CanBeNull] string name)
    => indexBuilder.HasName(name);

@AndriySvyryd
Copy link
Member

@ajcvickers Yes, we need to fix this ASAP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-model-building closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Projects
None yet
Development

No branches or pull requests

5 participants