Open Steve887 opened 5 years ago
Got this issue today when tried to migrate EF Core from 2.2.6 to 3.0.0 in Xamarin Forms project.
@mindphaser That's how I came across the issue as well. It appears the EF Core team has worked around the issue in the latest preview build 3.1.0-preview2.19525.5 with this commit: https://github.com/aspnet/EntityFrameworkCore/commit/5fec0d085ef7e5702208c1169758f4f2d4e996d7#diff-920a9f983bb40645fe12f779d7f2d6df
The NonNullableConventionBase
has been updated to do it's own filtering of Custom Attributes, rather than use the internal GetCustomAttribute
implementation.
@mindphaser I opened an issue in EFCore to track https://github.com/aspnet/EntityFrameworkCore/issues/18793
Got this issue today when tried to migrate EF Core from 3.1.7 to 5.0.0-rc.1.20451.13 in Xamarin Forms project.
Description
I ran into an interesting situation trying to get Entity Framework working in my Xamarin application which I have narrowed down to what seems to be a bug internally. This may be the wrong place to post this as it may be better on the AspNetCore repo so I will move if required.
The bug occurs when you call GetCustomAttribute on an inherited property's GetMethod ReturnParameter. This results in an
IndexOutOfRangeException
. However, if the same code is called from anetcoreapp3.0
application it works as expected.The exception occurs inside the internal
InternalParamGetCustomAttributes
method.The setup for this reproduction comes from Entity Framework Core's NonNullableConventionBase which is called during Model setup, but Entity Framework is not required to reproduce.
Steps to Reproduce
GetMethod.ReturnParameter.GetCustomAttribute
on an inherited property.Expected Behavior
The Custom Attribute is returned, or null if it doesn't exist.
Actual Behavior
System.IndexOutOfRangeException
Basic Information
Screenshots
Reproduction Link
IndexOutOfRangeException.zip Switch startup project between the Console app and Android app to see the issue.