Closed Wiggee11 closed 1 year ago
I haven't been able to replicate this I'm afraid @Wiggee11. These are the steps I took - if you can spot something different with how you replicate the error, I'd appreciate if you could let me know. Thanks.
dotnet new install Umbraco.Templates
dotnet new umbraco --name FormsTest
cd FormsTest
dotnet add package Umbraco.Forms
appSettings.json
and configured a SQL server connection string to an empty databasedotnet run
I have the same issue with Umbraco 10.4.0 and Umbraco.Forms 10.2.3 amd I dug a bit into it. The problem seem to be identifying a user with the id -1 in the table UFUserSecurity, so instead it tries to insert a new, causing the PK violation.
My primary admin user when installing Umbraco 10.4.0 gets the id -1. After installing Umbraco.Forms 10.2.3 I navigate to the Forms section in Backoffice and it works fine the first time. Looking in the database I can see a row getting inserted into UFUserSecurity with the User=-1. When I reload the Forms section I get the PK-violation error in the original post. If I delete the record with the user=-1 in UFUserSecurity and reload the Forms section it works fine again once. A new row with the user=-1 is inserted. And when I reload the Forms section I get the PK-violation error again.
If I create a new user in Umbraco, which gets an id > 0, and log in as this user, I can use Umbraco Forms as expected.
So a workaround if you encounter this problem might be to create a new user. But hopefully this can help fixing the issue.
Thanks @MartinRyttler - I think your clear description (plus your location!) has given me the clue as to what's going on here. We've had a few instances with how .NET encodes the minus sign in Swedish - and probably other cultures too, but for where Umbraco is generally used it seems to be Swedish is the one that comes up - so these lookups of the user with the "-1" ID can have issues where the parsing or creation isn't done with the the appropriate encoding.
I can see a case related here where we have missed this, and this would explain why I couldn't replicate the issue when it was first reported.
I've made an update that should fix this, and will be in the next releases.
If you had chance to try the fix on your installation to verify that it does solve the issue, it would be much appreciated. If so, you'll need to first add the following NuGet feed:
<add key="MyGetUmbracoNightly" value="https://www.myget.org/F/umbraconightly/api/v3/index.json" />
And once you have that, you should be able to install a preview of 10.2.4 by referencing the following package:
Umbraco.Forms.10.2.4--preview.2.g29753b0
Hopefully with that you'll find the "-1" user is added correctly and you no longer see this error being reported. Thanks in advance if you are able to verify.
Glad if it helped, and thanks for quick response. I'll see if I can install the preview version during the day to verify.
Hi all, just want to confirm that the above preview version fixed this issue for me.
I have a fresh install of Umbraco 10 I accidently installed Forms version 11 I uninstalled it Installed 10.2.3 Went into the back office and got the above error. Added the nuget package reference as per the above Installed the preview version Went into the back office again and no error!
Will keep you updated if anything else pops up :)
Nice, that's good to hear. Thanks for checking @RSDevelopsUK.
I can also verify that it works in my scenario. Good job @AndyButland H5YR
Expected result
Umbraco Forms should be installed successfully and accessible immediately without throwing any SQL exceptions.