Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sign in windows development machine is working, after publish to linux - error String '' was not recognized as a valid DateTime. #44

Open
kierepka opened this issue Oct 18, 2021 · 0 comments

Comments

@kierepka
Copy link

Result:

 fail: Microsoft.AspNetCore.Server.Kestrel[13]
 Connection id "0HMCIB3PQJ72M", Request id "0HMCIB3PQJ72M:00000002": An unhandled exception was thrown by the application.
 System.FormatException: String '' was not recognized as a valid DateTime.
    at System.DateTimeParse.Parse(ReadOnlySpan`1 s, DateTimeFormatInfo dtfi, DateTimeStyles styles, TimeSpan& offset)
    at System.DateTimeOffset.Parse(String input, IFormatProvider formatProvider, DateTimeStyles styles)
    at System.DateTimeOffset.Parse(String input, IFormatProvider formatProvider)
    at Microsoft.Data.Sqlite.SqliteValueReader.GetDateTimeOffset(Int32 ordinal)
    at Microsoft.Data.Sqlite.SqliteValueReader.GetFieldValue[T](Int32 ordinal)
    at Microsoft.Data.Sqlite.SqliteDataRecord.GetFieldValue[T](Int32 ordinal)
    at Microsoft.Data.Sqlite.SqliteDataReader.GetFieldValue[T](Int32 ordinal)
    at lambda_method104(Closure , QueryContext , DbDataReader , ResultContext , SingleQueryResultCoordinator )
    at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
    at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
    at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
    at Microsoft.AspNetCore.Identity.UserManager`1.FindByNameAsync(String userName)
    at Microsoft.AspNetCore.Identity.SignInManager`1.PasswordSignInAsync(String userName, String password, Boolean isPersistent, Boolean lockoutOnFailure)
    at BioMindsXRSrv.Web.Controllers.UserController.Login(String userName, String password) in D:\GitHub\BioMindsXR_Srv\BioMindsXRSrv.Web\Controllers\UserController.cs:line 78
    at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
 --- End of stack trace from previous location ---
    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
 --- End of stack trace from previous location ---
    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
    at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
    at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
    at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
    at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

Code for login:

var addInfo = string.Empty;
            if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(password))
            {

[78line]                var result = await signInManager.PasswordSignInAsync(userName, password, false, false);
                addInfo = result.ToString();
                if (result.Succeeded)
                {
                    return Redirect("~/");
                }
            }

user:

    public class User : IdentityUser<Guid>
    {
        [DisallowNull]
        [Required]
        [PersonalData]
        public string FirstName { get; set; } = string.Empty;

        [DisallowNull]
        [Required]
        [PersonalData]
        public string LastName { get; set; } = string.Empty;

        [PersonalData]
        public UserSettings UserSettings { get; set; } = new UserSettings();

        [PersonalData]
        public ICollection<UserTherapy>? UserQuests { get; set; }
        [PersonalData]
        public bool IsAdmin { get; set; }
        [PersonalData]
        public bool IsDoctor { get; set; }
        [PersonalData]
        public Guid? DoctorId { get; set; }

        [NotMapped]
        public IEnumerable<string> RoleNames { get; set; }

        [IgnoreDataMember, NotMapped]
        public string Password { get; set; }

        [IgnoreDataMember, NotMapped]
        public string ConfirmPassword { get; set; }

        [IgnoreDataMember, NotMapped]
        public string Name
        {
            get => UserName;
            set => UserName = value;
        }
        [PersonalData]
        public string? HospitalName
        {
            get;
            set;
        }
        [PersonalData]
        public string? Phone
        {
            get;
            set;
        }

        [PersonalData]
        public DateTime? DateOfTheTest { get; set; }

        [PersonalData]
        public string? Diagnosis { get; set; }

        [PersonalData]
        public DateTime? DateOfDiagnosis { get; set; }

        [PersonalData]
        public DateTime? StartDateOfTherapy { get; set; }
        [PersonalData]
        public EHandiness? Handiness { get; set; }

        [PersonalData]
        public string? AdlScores { get; set; }

        [PersonalData]
        public string? BarthelResults { get; set; }

        [PersonalData]
        public string? NeuropsychologicalResults { get; set; }

        [PersonalData]
        public string? Other { get; set; }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant