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

[12 Jun 2021 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 2021 7:52] Inze Bielderman
Stacktrace

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

[12 Jun 2021 7:52] Inze Bielderman
Verbose Output

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

[31 Jan 2022 12:49] MySQL Verification Team
Thank you for the bug report. Could you please try with the latest version? Thanks.
[1 Mar 2022 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".