'Visual Studio Debugger freezes on XDocument query

I am having issues with the Visual Studio 2022 debugger whilst implementing a VSTO PPT addin. However, in the built version the VSTO Addin works just fine and does not crash.

My code:

var config = Configuration; //Configuration is an XDocument
var query = config.Root.Elements("MyElement");

If I remove the second line the debugger works just fine, but obviously I need to read the XML message.

var config = Configuration; //Configuration is an XDocument
//var query = config.Root.Elements("MyElement");

snippet of the XML:

<?xml version="1.0" encoding="utf-8"?>
<AddinConfig>
  <PPTConfig>
    <MyElement>true</MyElement>
  </PPTConfig>
  <XLSConfig />
</AddinConfig>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source