Thanks for sharing the details
The hang occurs because Visual Studio 2022 no longer supports retrieving IVsMDCodeDomProvider through synchronous GetService. This service must be loaded via the async service provider. Please replace your service lookup with:
var asyncServiceProvider = (IAsyncServiceProvider)Package.GetGlobalService(typeof(SAsyncServiceProvider));
var codeDomProvider = await asyncServiceProvider
.GetServiceAsync(typeof(SVsMDCodeDomProvider))
as IVsMDCodeDomProvider;
If your generator does not support async execution, preload this service in your package’s async initialization and use the cached instance. Synchronous service calls will hang in VS2022, which is the behavior you are seeing.