Bug #99523 MySql.Data.EntityFrameworkCore Nuget Package 8.0.20

Submitted: 12 May 2020 9:06 Modified: 10 Jul 2020 19:05
Reporter: varun wadhwa Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:8.0.20 OS:Any
Assigned to: CPU Architecture:Any
Tags: .net, .NetCore, EntityFrameworkCore, MySql.Data.EntityFrameworkCore

[12 May 2020 9:06] varun wadhwa
Description:
I was trying to execute this code
 public List<SelectListItem> y() { 
var a = new List<SelectListItem>();

            a = _context.Emp.OrderBy(x =&gt; x.EmpId).Select(n =&gt;
               new SelectListItem
               {
                   Value = Convert.ToString(n.EmpId),
                   Text = n.Name
               }).ToList();
        return a;
    }
but it is giving exception (MySql.Data.MySqlClient.MySqlException ) "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'text) AS Value, e.name AS Text\nFROM emp AS e\nORDER BY e.emp_id' at line 1"

and I do not think there is any syntax error.

How to repeat:
Create an asp.net core application with SDK 3.1,  MySql.Data.EntityFrameworkCore Nuget Package 8.0.20, Microsoft.EntityFrameworkCore 3.1.1  and  Microsoft.EntityFrameworkCore.Design 3.1.1. Try to create a dynamic dropdown using the   code given below 
List<SelectListItem>();

            a = _context.Emp.OrderBy(x =&gt; x.EmpId).Select(n =&gt;
               new SelectListItem
               {
                   Value = Convert.ToString(n.EmpId),
                   Text = n.Name
               }).ToList();
        return a;
    }
[12 May 2020 9:22] varun wadhwa
public List<SelectListItem> y()
        {
            var a = new List<SelectListItem>();

            a = _context.Emp.OrderBy(x =>  x.EmpId).Select(n =>
            new SelectListItem
            {
                Value = Convert.ToString(n.EmpId),
                Text = n.Name
            }).ToList();
            return a;
        }
[10 Jul 2020 19:05] Christine Cole
Posted by developer:
 
Fixed as of the upcoming MySQL Connector/NET 8.0.22 release, and here's the proposed changelog entry from the documentation team:

A SQL syntax error was reported on valid code for creating a dynamic
dropdown list from data in an ASP.NET Core application.

Thank you for the bug report.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.