0

I receive these two exceptions when I run my blazor web server app:

  1. XmlException: Root element is missing.
  2. CryptographicException: An error occurred while trying to encrypt the provided data. Refer to the inner exception for more information.

I just created the project and run it... I didn't write any piece of code . Any help is appreciated because I didn't find any solution till now.

Screenshot of the error

someone
  • 139
  • 1
  • 12
  • You basically have some corrupt data somewhere. Create another project and see if it happens again? – Jesse Good Apr 22 '22 at 03:49
  • What's your Visual Studio's version? I think it may be missing some data, Check this [issue](https://stackoverflow.com/questions/3772486/how-to-fix-root-element-is-missing-when-doing-a-visual-studio-vs-build) and try to upload your vs and create a new project to try again. – Xinran Shen Apr 22 '22 at 05:47
  • @JesseGood I did create more than a project and still have the same issue but with Blazor web assembly model everything is working fine – someone Apr 22 '22 at 06:52
  • @XinranShen Dear I am using vs 2019 I also tried the answer in the issue you are pointing at before asking the question here.. – someone Apr 22 '22 at 06:54
  • @someone, Does this issue only show in Blazor or anyother project in VS? – Xinran Shen Apr 22 '22 at 07:10
  • @XinranShen only Blazor Web Server other projects works well even Blazor Web Assembly is working good – someone Apr 22 '22 at 08:12
  • @someone,You can create a new blazor project and push it to github, I can test your project in my visual studio, If there is nothing wrong in my pc,I think it can rule out the error of blazor itself – Xinran Shen Apr 22 '22 at 08:48
  • @XinranShen I just created a new project with the same issue Link : https://github.com/HaNassar/Blazor ... Thanks in advance – someone Apr 23 '22 at 08:27
  • @someone, I have tried your code in my PC, I tested it in `visual studio 2019` and `visual studio 2022` and it all can work well, So there is nothing wrong with the project itself, I think you can repair your visual studio in `Visual Studio Installer` first and try again. – Xinran Shen Apr 25 '22 at 01:19
  • @XinranShen thanks for your efforts i will check VS to find the problem – someone Apr 25 '22 at 09:53

1 Answers1

0

I have found two solutions to fix this issue if someone faced it later.

links to solution:

  1. https://github.com/dotnet/aspnetcore/issues/12830#issuecomment-517907537
  2. https://github.com/dotnet/aspnetcore/issues/12830#issuecomment-606173185
someone
  • 139
  • 1
  • 12