Bug #103990 OverflowException: Unsigned integers not handled properly
Submitted: 12 Jun 7:50 Modified: 14 Jun 6:30
Reporter: Inze Bielderman (OCA) Email Updates:
Status: Analyzing Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:v5.0.3.1 OS:Microsoft Windows (Build 19024)
Assigned to: MySQL Verification Team CPU Architecture:Any

[12 Jun 7:50] Inze Bielderman
Description:
I have a table with an `smallint unsigned` column, and the class that represents this table.
Along with that I have a context set up, both created by the `dotnet ef dbcontext scaffold` command.

With that, I have a simple index page set up

Once I enter a value in the table that is higher than `32767` (Max `int16`, vs `65535` as max `uint16`), the error occurs

How to repeat:
Complete runnable source can be found [here](https://github.com/inzenl/ef-testapplication)

I have a table with an `smallint unsigned` column, and the class that represents this table
```csharp
public partial class ATable
{
    public ushort? SomeNumber { get; set; }
}
```
Along with that I have a context set up, both created by the `dotnet ef dbcontext scaffold` command.

With that, I have a simple index page set up
```razor
@page "/"
@using Microsoft.EntityFrameworkCore

@code
{
    protected override Task OnInitializedAsync()
    {
        var context = new ef_testContext();
        return context.ATables.ToListAsync();
    }
}
```

Once I enter a value in the table that is higher than `32767` (Max `int16`, vs `65535` as max `uint16`), the error occurs

Suggested fix:
It seems it only looks at the integer size, and not whether it is signed or unsigned.
[12 Jun 7:52] Inze Bielderman
Stacktrace

Attachment: Stacktrace.txt (text/plain), 7.33 KiB.

[12 Jun 7:52] Inze Bielderman
Verbose Output

Attachment: Verbose Output.txt (text/plain), 3.66 KiB.