second run exception
running this code throws an exception on the second run
AppDomain.CurrentDomain.GetAssemblies().ToList().ForEach(cd =>
{
cd.GetTypes().Dump();
});
any advice?
Comments
-
having the same issue, would love to get a solution
this is he error I am getting
Unable to load one or more of the requested types. Could not load file or assembly 'Microsoft.Windows.SDK.NET, Version=10.0.17763.24, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. Could not load file or assembly 'Microsoft.Windows.SDK.NET, Version=10.0.17763.24, Culture=neutral, .....
-
Workaround
Since this error is not happening the the first time that the query is executed, enabling Always use Fresh Process per Execution in advanced settings solves the problem
-
"Always use Fresh Process per Execution = True" can cause side effects in other queries and or can be slow because it needs to create new process everytime.
As a general rule I would keep that set to "False" and instead use Util.NewProcess = true; when query code needs a fresh process.
Util.NewProcess = true; AppDomain.CurrentDomain.GetAssemblies().ToList().ForEach(cd => { cd.GetTypes().Dump(); });