CodeSparks-org / CodeSparks

https://codesparks.org/
2 stars 3 forks source link

Unrecognized Guid format #8

Closed smellilac closed 2 weeks ago

smellilac commented 1 month ago

Hello!

After your commits today a problem appeared, unfortunately I couldn't find the error

FormatException: Unrecognized Guid format.
System.Guid+GuidResult.SetFailure(ParseFailure failureKind)
System.Guid.TryParseGuid(ReadOnlySpan<char> guidString, ref GuidResult result)
System.Guid..ctor(string g)
System.ComponentModel.GuidConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
Microsoft.AspNetCore.Identity.UserStoreBase<TUser, TKey, TUserClaim, TUserLogin, TUserToken>.ConvertIdFromString(string id)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserStore<TUser, TRole, TContext, TKey, TUserClaim, TUserRole, TUserLogin, TUserToken, TRoleClaim>.FindByIdAsync(string userId, CancellationToken cancellationToken)
Microsoft.AspNetCore.Identity.UserManager<TUser>.GetUserAsync(ClaimsPrincipal principal)
Microsoft.AspNetCore.Identity.SignInManager<TUser>.ValidateSecurityStampAsync(ClaimsPrincipal principal)
Microsoft.AspNetCore.Identity.SecurityStampValidator<TUser>.ValidateAsync(CookieValidatePrincipalContext context)
Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler.HandleAuthenticateAsync()
Microsoft.AspNetCore.Authentication.AuthenticationHandler<TOptions>.AuthenticateAsync()
Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, string scheme)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
gbdrm commented 1 month ago

Hey, I've re-generated database from scratch because of changing some of the IDs from long to Guid. So, if you have any data in database, you probably need to migrate or delete it.

If you don't have any important data in the database, just delete it, create an empty one and run migrations. Sorry, I didn't know someone is following it. Will not do such a global changes in future :)

Let me know if any issues - here or in telegram chat.

smellilac commented 1 month ago

Hey, I've re-generated database from scratch because of changing some of the IDs from long to Guid. So, if you have any data in database, you probably need to migrate or delete it.

If you don't have any important data in the database, just delete it, create an empty one and run migrations. Sorry, I didn't know someone is following it. Will not do such a global changes in future :)

Let me know if any issues - here or in telegram chat.

Yes, I understand that you changed some identifiers.

I did everything as you said, but the problem is not solved.

So, I will explain two problems that I found after your commits today.

1) When creating a database (just when creating an empty database using PgAdmin), the application is built with an error. Moreover, when re-using "dotnet build" the error goes away. Probably there are small problems with the compiler when the application is first launched. But this is a small error.

2) I create an empty database and apply migrations or create a database via "ensure created" and then apply migrations, in any of these cases I get the error I specified in the previous message. I am attaching a photo to the second error.

photo_2024-08-11_19-46-22 photo_2024-08-11_19-46-30 photo_2024-08-11_19-46-12

gbdrm commented 1 month ago

Looks pretty strange and probably I need more details to understand this. I've just created an empty database, applied the migrations and started an app. No issues at all.

p.s. I hope you will change you system language, or whatever the source of those weird letters is. By the way - that localization may be the root cause of issues as well, who knows what are the standards for Guid or some other data types parsing in the swamps.

smellilac commented 1 month ago

This is my native language, not all the community is English speaking :sweat_smile:

I doubt that the problem is in localization, I checked the types of guids beforehand, but did not find any errors. Today I will check all the tables. And it should not cause any problems. One thing is string encoding or time format, and another thing is guids

Looks pretty strange and probably I need more details to understand this. I've just created an empty database, applied the migrations and started an app. No issues at all.

p.s. I hope you will change you system language, or whatever the source of those weird letters is. By the way - that localization may be the root cause of issues as well, who knows what are the standards for Guid or some other data types parsing in the swamps.

gbdrm commented 1 month ago

Oh.. I am sorry to hear that your native language is russian, and I hope you are able to escape all that terrible impact that it brings. If you are ready to experiment - you can create a new database, delete the migration and re-generate them again. Try to update-database afterwards, if that works - we will understand that the issue is related to local configuration somehow.

gbdrm commented 2 weeks ago

Inactive for a couple of weeks, feel free to create a new issue if required.