I found that I have experienced a temporary issue with my development environment, specifically Visual Studio, which sometimes show errors in code that aren’t really there.
The fact that the error disappeared after a while is a strong indicator that it might have been a temporary glitch or confusion in my code editor.