In order to find the cause of the error more accurately, please provide more code and information to reproduce the situation.
And based on your error, I suggest you try the following steps in first.
- Perform clean build operation for the solution
- Deleting the bin and obj folders
- Then re-build the solution.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.