Bug #99523 MySql.Data.EntityFrameworkCore Nuget Package 8.0.20
Submitted: 12 May 9:06 Modified: 12 May 15:35
Reporter: varun wadhwa Email Updates:
Status: Verified 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 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 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;
        }