dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.7k stars 3.98k forks source link

Semantic Search: Consider adding support for in-proc query execution #72617

Open tmat opened 3 months ago

tmat commented 3 months ago

Currently the feature only works when VS is running Roslyn OOP.

This is to isolate the query execution better and avoid crashing the entire VS if something goes wrong or consume VS process resources. In addition we are taking advantage of .NET features not available on Desktop, such as managing assembly loading via AssemblyLoadContext and unloading of the generated assembly. We wouldn't be able to unload the assembly when running on Desktop (the assembly itself would leak and we might want to clear all generated static variables to avoid accidentally leaking Roslyn solution snapshot).

With this in mind and some restrictions we could potentially support the feature running in-proc.

CyrusNajmabadi commented 3 months ago

as this is running arbitrary code, including code taht can stack-overflow, my preference would be that we never run things in proc. An isolated process seems like an ideal way to keep things safe.

tmat commented 3 months ago

We do have some guards against stack overflow, but they are not 100% bulletproof.