24 lines
776 B
C#
24 lines
776 B
C#
using System.Reflection;
|
|
|
|
namespace RobotNet.WebApp.Helpers;
|
|
|
|
public static class DefaultPersistentStorageConfigurationExtensions
|
|
{
|
|
/// <summary>
|
|
/// Sửa lỗi Exception "System.Diagnostics.Process is not supported on this platform."
|
|
/// trong static constructor của Microsoft.CodeAnalysis.Host.DefaultPersistentStorageConfiguration
|
|
/// khi gọi CompletionService.GetCompletionsAsync
|
|
/// </summary>
|
|
public static void FixStaticConstructorException()
|
|
{
|
|
try
|
|
{
|
|
_ = typeof(Microsoft.CodeAnalysis.Host.HostServices).Assembly.CreateInstance("Microsoft.CodeAnalysis.Host.DefaultPersistentStorageConfiguration");
|
|
}
|
|
catch (TargetInvocationException)
|
|
{
|
|
GC.Collect();
|
|
}
|
|
}
|
|
}
|