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

HasData with an empty array property #20432

Closed
pikausp opened this issue Mar 27, 2020 · 0 comments · Fixed by #21044
Closed

HasData with an empty array property #20432

pikausp opened this issue Mar 27, 2020 · 0 comments · Fixed by #21044
Labels
area-type-mapping 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

@pikausp
Copy link

pikausp commented Mar 27, 2020

Let's say we have the following model.

public class User {
  public string[] Tags { get; set; } = new string[0];
}

The array is non-nullable and hence we have to provide some value. For simplicity, I initialized the array on the property level. When attempting to seed users, the generated migration uses new [] {} syntax and since the array is empty the compiler cannot infer the type and compilation/migration application fails.

Further technical details

EF Core version: 3.1.2
Database provider: Npgsql.EntityFrameworkCore.PostgreSQL
Target framework: .NET Core 3.1
Operating system: Windows 10
IDE: Visual Studio 2019 16.5.1

@ajcvickers ajcvickers self-assigned this Mar 27, 2020
@ajcvickers ajcvickers added this to the 5.0.0 milestone Mar 27, 2020
ajcvickers added a commit that referenced this issue May 25, 2020
Fixes #20432

Issue was already fixed in 5.0. Adding tests.
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label May 25, 2020
ajcvickers added a commit that referenced this issue May 31, 2020
Fixes #20432

Issue was already fixed in 5.0. Adding tests.
ajcvickers added a commit that referenced this issue Jun 1, 2020
Fixes #20432

Issue was already fixed in 5.0. Adding tests.
@ajcvickers ajcvickers modified the milestones: 5.0.0, 5.0.0-preview6 Jun 1, 2020
@ajcvickers ajcvickers modified the milestones: 5.0.0-preview6, 5.0.0 Nov 7, 2020
@ajcvickers ajcvickers removed their assignment Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-type-mapping 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

Successfully merging a pull request may close this issue.

2 participants