Hello Enrico, I'm Johrelle a fellow Windows/Microsoft user. I'm happy to assist you.
First, make sure that the Game Bar is enabled in the Windows settings. Open Settings > Gaming > Xbox Game Bar. Ensure the toggle for "Enable Xbox Game Bar for things like recording game clips, chatting with friends, and receiving game invites" is turned on.
If it's turned on, try resetting the Game Bar and check if you can record. Go to Settings > Apps > Apps & features. Find the Xbox Game Bar in the list and click on it. Click on Advanced options. Scroll down and click on Reset.