Bug #75566 "You have an error in your SQL syntax" after upgrading from EF 6.1.1 to 6.1.2
Description:
After upgrading a Visual Studio 2013 MVC web project from EntityFramework 6.1.1 to 6.1.2, I get the following error from MySQL:
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 'FROM ((SELECT
CASE WHEN (`Extent2`.`RoleId` IS NULL) THEN (NULL) ELSE (1) END' at line 31
The error is caught by the CookieAuthenticationProvider OnException callback in Startup.Auth.cs. I believe the query is triggered somewhere in the Microsoft Identity code.
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
Provider = new CookieAuthenticationProvider
{
// Enables the application to validate the security stamp when the user logs in.
// This is a security feature which is used when you change a password or add an external login to your account.
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<MakeUserManager, MakeUser, int>(
validateInterval: TimeSpan.FromMinutes(30),
regenerateIdentityCallback: (manager, user) => user.GenerateUserIdentityAsync(manager),
getUserIdCallback: (id) => (Int32.Parse(id.GetUserId()))),
OnException = context => { ErrorLogging.LogError("Make.Designer.Web.Startup.ConfigureAuth()", "An error occured while initializing the CookieAuthenticationProvider.", context.Exception); }
}
});
How to repeat:
Create an MVC web project in Visual Studio 2013, using individual user accounts. Add the EntityFramework 6.1.2 Nuget Package. Set up the cookie authentication in Startup.Auth.cs as follows:
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
Provider = new CookieAuthenticationProvider
{
// Enables the application to validate the security stamp when the user logs in.
// This is a security feature which is used when you change a password or add an external login to your account.
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<MakeUserManager, MakeUser, int>(
validateInterval: TimeSpan.FromMinutes(30),
regenerateIdentityCallback: (manager, user) => user.GenerateUserIdentityAsync(manager),
getUserIdCallback: (id) => (Int32.Parse(id.GetUserId()))),
OnException = context => { Exception ex = context.Exception); }
}
});
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.052 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.
Description: After upgrading a Visual Studio 2013 MVC web project from EntityFramework 6.1.1 to 6.1.2, I get the following error from MySQL: 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 'FROM ((SELECT CASE WHEN (`Extent2`.`RoleId` IS NULL) THEN (NULL) ELSE (1) END' at line 31 The error is caught by the CookieAuthenticationProvider OnException callback in Startup.Auth.cs. I believe the query is triggered somewhere in the Microsoft Identity code. app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login"), Provider = new CookieAuthenticationProvider { // Enables the application to validate the security stamp when the user logs in. // This is a security feature which is used when you change a password or add an external login to your account. OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<MakeUserManager, MakeUser, int>( validateInterval: TimeSpan.FromMinutes(30), regenerateIdentityCallback: (manager, user) => user.GenerateUserIdentityAsync(manager), getUserIdCallback: (id) => (Int32.Parse(id.GetUserId()))), OnException = context => { ErrorLogging.LogError("Make.Designer.Web.Startup.ConfigureAuth()", "An error occured while initializing the CookieAuthenticationProvider.", context.Exception); } } }); How to repeat: Create an MVC web project in Visual Studio 2013, using individual user accounts. Add the EntityFramework 6.1.2 Nuget Package. Set up the cookie authentication in Startup.Auth.cs as follows: app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login"), Provider = new CookieAuthenticationProvider { // Enables the application to validate the security stamp when the user logs in. // This is a security feature which is used when you change a password or add an external login to your account. OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<MakeUserManager, MakeUser, int>( validateInterval: TimeSpan.FromMinutes(30), regenerateIdentityCallback: (manager, user) => user.GenerateUserIdentityAsync(manager), getUserIdCallback: (id) => (Int32.Parse(id.GetUserId()))), OnException = context => { Exception ex = context.Exception); } } });