The input string had an invalid format. Entity Framework 6
Good day to all, I have been trying to solve this problem for a long time, I do not understand what the problem is.
I use ORM Entity Framework 6 and MySQL DBMS. I used the project for about 2 weeks, everything was fine, suddenly an exception occurred today. It occurs when creating a table, i.e. in context.SaveChanges()
.
At first, everything was fine, I used it for 2 weeks and, suddenly, today I get such an exception.
ex.StackTrace
в System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)
в System.Convert.ToDouble(String value)
в MySql.Data.EntityFramework.MySqlMigrationSqlGenerator.Generate(CreateIndexOperation op)
в MySql.Data.EntityFramework.MySqlMigrationSqlGenerator.<.ctor>b__22_4(MigrationOperation op)
в MySql.Data.EntityFramework.MySqlMigrationSqlGenerator.Generate(IEnumerable`1 migrationOperations, String providerManifestToken)
в System.Data.Entity.Migrations.DbMigrator.GenerateStatements(IList`1 operations, String migrationId)
в System.Data.Entity.Migrations.DbMigrator.ExecuteOperations(String migrationId, VersionedModel targetModel, IEnumerable`1 operations, IEnumerable`1 systemOperations, Boolean downgrading, Boolean auto)
в System.Data.Entity.Migrations.DbMigrator.AutoMigrate(String migrationId, VersionedModel sourceModel, VersionedModel targetModel, Boolean downgrading)
в System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
в System.Data.Entity.Migrations.DbMigrator.UpdateInternal(String targetMigration)
в System.Data.Entity.Migrations.DbMigrator.<>c__DisplayClass42_0.<Update>b__0()
в System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase)
в System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration)
в System.Data.Entity.Internal.DatabaseCreator.CreateDatabase(InternalContext internalContext, Func`3 createMigrator, ObjectContext objectContext)
в System.Data.Entity.Internal.InternalContext.CreateDatabase(ObjectContext objectContext, DatabaseExistenceState existenceState)
в System.Data.Entity.Database.Create(DatabaseExistenceState existenceState)
в System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context)
в System.Data.Entity.Internal.InternalContext.<>c__DisplayClass66_0`1.<CreateInitializationAction>b__0()
в System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action)
в System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization()
в System.Data.Entity.Internal.LazyInternalContext.<>c.<InitializeDatabase>b__58_0(InternalContext c)
в System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input)
в System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action)
в System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase()
в System.Data.Entity.Internal.InternalContext.Initialize()
в System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
в System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
в System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
в System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
в System.Data.Entity.QueryableExtensions.FirstOrDefaultAsync[TSource](IQueryable`1 source, Expression`1 predicate, CancellationToken cancellationToken)
в System.Data.Entity.QueryableExtensions.FirstOrDefaultAsync[TSource](IQueryable`1 source, Expression`1 predicate)
в Microsoft.AspNet.Identity.EntityFramework.UserStore`6.<GetUserAggregateAsync>d__67.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
в Microsoft.AspNet.Identity.TaskExtensions.CultureAwaiter`1.GetResult()
в Microsoft.AspNet.Identity.UserValidator`2.<ValidateUserName>d__14.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
в Microsoft.AspNet.Identity.UserValidator`2.<ValidateAsync>d__13.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
в Microsoft.AspNet.Identity.UserManager`2.<CreateAsync>d__73.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
в Microsoft.AspNet.Identity.UserManager`2.<CreateAsync>d__79.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
в System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
в OAuth2.InitializeDatabase.Initializer.<Create>d__1.MoveNext() в F:\\Programing\\ERP\\ERP Xamarin\\Web API\\OAuth2\\OAuth2\\InitializeDatabase\\Initializer.cs
public class Initializer :DropCreateDatabaseAlways<ApplicationDbContext>
{
public Initializer()
{
Create();
}
public async void Create()
{
using (ApplicationDbContext context = new ApplicationDbContext())
{
var manager = new UserManager<ApplicationUser, int>(new CustomUserStore(new ApplicationDbContext()));
var roleManager = new RoleManager<CustomRole, int>(new CustomRoleStore(new ApplicationDbContext()));
var user = new ApplicationUser
{
UserName = "User1",
Email = "[email protected]",
FirstName = "Вася",
LastName = "Пупкин",
NumberPassport = "123456789",
PhoneNumber = "912342655675",
UserSignature = "!@#dfsfsf2#@#!FGDFGDFGDAS!@#@",
};
WorkerCard card1 = new WorkerCard { BeginingTime = "8:00", EndTime = "16:30", Date = "7.27.2020", Day = "Sunday", Month = "july", Timeout = true, TotalWorkTime = 8, FK_User = user };
context.WorkerCards.Add(card1);
context.SaveChanges();
}
}
}
0