gpt4 book ai didi

c# - 如何配置 Roslyn CustomWorkSpace 不为 Visual Basic 而哭泣?

转载 作者:太空狗 更新时间:2023-10-30 00:52:04 25 4
gpt4 key购买 nike

我有一个简单的 Roslyn 代码行如下:

var workspace = new CustomWorkspace();

此行抛出(并在内部处理)如下异常:

"Could not load file or assembly 'Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=0.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified."

请注意,仅当您在调试器中运行代码并配置 VS 以仅显示未处理的异常时,异常才可见。

我根本不想使用 Visual Basic 的功能。我已经查看了 Workspace 构造函数重载,最有前途的是接受 FeauterPack 的重载,但不幸的是

 public class CSharpWorkspaceFeatures : FeaturePack

当前不存在(并且在当前 Roslyn 源代码中也被完全注释掉)

我错过了什么吗?

提前致谢

E D I T:对于@SLaks:(我没有使用 Roslyn 源代码运行,只是使用 NuGet 包。所以这是我拥有的所有异常信息:

System.IO.FileNotFoundException occurred
HResult=-2147024894
Message=Could not load file or assembly 'Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=0.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Source=mscorlib
FileName=Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=0.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
FusionLog==== Pre-bind state information ===
LOG: DisplayName = Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=0.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///D:/2014Develop.Core.Tests
LOG: Initial PrivatePath = NULL
Calling assembly : Microsoft.CodeAnalysis.Workspaces, Version=0.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\2014Develop\Core.Tests\Core.Tests.dll.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=0.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///D:/2014Develop.Core.Tests/Microsoft.CodeAnalysis.VisualBasic.Workspaces.DLL.
LOG: Attempting download of new URL file:///D:/2014Develop.Core.Tests/Microsoft.CodeAnalysis.VisualBasic.Workspaces/Microsoft.CodeAnalysis.VisualBasic.Workspaces.DLL.
LOG: Attempting download of new URL file:///D:/2014Develop.Core.Tests/Microsoft.CodeAnalysis.VisualBasic.Workspaces.EXE.
LOG: Attempting download of new URL file:///D:/2014Develop.Core.Tests/Microsoft.CodeAnalysis.VisualBasic.Workspaces/Microsoft.CodeAnalysis.VisualBasic.Workspaces.EXE.

StackTrace:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
InnerException:

调用堆栈窗口中的堆栈跟踪:

mscorlib.dll!System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity, System.Reflection.RuntimeAssembly reqAssembly, ref System.Threading.StackCrawlMark stackMark, System.IntPtr pPrivHostBinder, bool throwOnFileNotFound, bool forIntrospection, bool suppressSecurityChecks) + 0xd2 bytes   
mscorlib.dll!System.Reflection.RuntimeAssembly.InternalLoad(string assemblyString, System.Security.Policy.Evidence assemblySecurity, ref System.Threading.StackCrawlMark stackMark, System.IntPtr pPrivHostBinder, bool forIntrospection) + 0xf2 bytes
mscorlib.dll!System.Reflection.RuntimeAssembly.InternalLoad(string assemblyString, System.Security.Policy.Evidence assemblySecurity, ref System.Threading.StackCrawlMark stackMark, bool forIntrospection) + 0x11 bytes
mscorlib.dll!System.Reflection.Assembly.Load(string assemblyString) + 0x23 bytes
Microsoft.CodeAnalysis.Workspaces.dll!Microsoft.CodeAnalysis.WellKnownFeatures.LoadAssembly(System.Collections.Generic.List<System.Reflection.Assembly> assemblies = Count = 2, string assemblyName = "Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=0.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35") + 0x3f bytes
Microsoft.CodeAnalysis.Workspaces.dll!Microsoft.CodeAnalysis.WellKnownFeatures.ComputePack() + 0x2a4 bytes
Microsoft.CodeAnalysis.Workspaces.dll!Microsoft.CodeAnalysis.WellKnownFeatures.Features.get() + 0x3f bytes
Microsoft.CodeAnalysis.Workspaces.dll!Microsoft.CodeAnalysis.CustomWorkspace.CustomWorkspace(string workspaceKind = "Host") + 0x32 bytes
Microsoft.CodeAnalysis.Workspaces.dll!Microsoft.CodeAnalysis.CustomWorkspace.CustomWorkspace() + 0x35 bytes
SolutionValidator.Core.dll!SolutionValidator.CodeInspection.Refactoring.TreeRefactorRule<SolutionValidator.CodeInspection.Refactoring.RenamePrivateFieldsRewriter>.TreeRefactorRule(SolutionValidator.Configuration.IncludeExcludeCollection sourceFileFilters = null, SolutionValidator.FolderStructure.IFileSystemHelper fileSystemHelper = {Castle.Proxies.IFileSystemHelperProxy}, string fileNamePattern = "*.cs", bool isBackupEnabled = false) Line 36 + 0x21 bytes C#
SolutionValidator.Core.dll!SolutionValidator.CodeInspection.Refactoring.RenamePrivateFieldsTreeRefactorRule.RenamePrivateFieldsTreeRefactorRule(string find = "^([a-zA-Z][a-zA-Z0-9_]*$)", string replace = "_$1", SolutionValidator.Configuration.IncludeExcludeCollection sourceFileFilters = null, SolutionValidator.FolderStructure.IFileSystemHelper fileSystemHelper = {Castle.Proxies.IFileSystemHelperProxy}, string fileNamePattern = "*.cs", bool isBackupEnabled = false) Line 32 + 0x2c bytes C#
SolutionValidator.Core.Tests.dll!SolutionValidator.Tests.Validator.CodeInspection.RenamePrivateFieldsRefactorRuleTest.TestRenamePrivateFieldsRefactorRuleTest(string dummy = "Current scenarios", string inputSource = "\r\n\t\tclass C\r\n\t\t{\r\n\t\t\tprivate int aaa, bbb = 1;\r\n\t\t\tprivate int xxx;\r\n\t\t\tprivate int yyy;\r\n\r\n\t\t\tpublic int Xxx\r\n\t\t\t{\r\n\t\t\t\tget { return xxx; }\r\n\t\t\t\tset { xxx = value; }\r\n\t\t\t}\r\n\r\n\t\t\tprivate void M()\r\n\t\t\t{\r\n\t\t\t\tvar local = 10;\r\n\t\t\t\tConsole.WriteLine(\"Hello, World! {0} {1}\", yyy, local);\r\n\t\t\t\txxx = 3;\r\n\t\t\t\txxx = 4;\r\n\t\t\t\txxx = xxx;\r\n\t\t\t\tvar any = xxx.ToString();\r\n\t\t\t\tAnyMethod(xxx.ToString(), xxx.ToString(), xxx, xxx + 1);\r\n\t\t\t}\r\n\t\t}", string outputSource = "\r\n\t\tclass C\r\n\t\t{\r\n\t\t\tprivate int _aaa,_bbb = 1;\r\n\t\t\tprivate int _xxx;\r\n\t\t\tprivate int _yyy;\r\n\r\n\t\t\tpublic int Xxx\r\n\t\t\t{\r\n\t\t\t\tget { return _xxx; }\r\n\t\t\t\tset { _xxx = value; }\r\n\t\t\t}\r\n\r\n\t\t\tprivate void M()\r\n\t\t\t{\r\n\t\t\t\tvar local = 10;\r\n\t\t\t\tConsole.WriteLine(\"Hello, World! {0} {1}\", _yyy, local);\r\n\t\t\t\t_xxx = 3;\r\n\t\t\t\t_xxx = 4;\r\n\t\t\t\t_xxx = _xxx;\r\n\t\t\t\tvar any = _xxx.ToString();\r\n\t\t\t\tAnyMethod(_xxx.ToString(), _xxx.ToString(), _xxx, _xxx + 1);\r\n\t\t\t}\r\n\t\t}") Line 112 + 0x152 bytes C#
[Native to Managed Transition]
nunit.core.dll!NUnit.Core.Reflect.InvokeMethod(System.Reflection.MethodInfo method = {System.Reflection.RuntimeMethodInfo}, object fixture = {SolutionValidator.Tests.Validator.CodeInspection.RenamePrivateFieldsRefactorRuleTest}, object[] args = {object[3]}) + 0x7f bytes
nunit.core.dll!NUnit.Core.TestMethod.RunTestMethod() + 0xa9 bytes
nunit.core.dll!NUnit.Core.TestMethod.RunTestCase(NUnit.Core.TestResult testResult = {NUnit.Core.TestResult}) + 0x58 bytes
nunit.core.dll!NUnit.Core.TestMethod.RunTest() + 0xdf bytes
nunit.core.dll!NUnit.Core.NUnitTestMethod.RunTest() + 0x3b bytes
nunit.core.dll!NUnit.Core.TestMethod.RunRepeatedTest() + 0x14b bytes
nunit.core.dll!NUnit.Core.TestMethod.RunTestInContext() + 0x81d bytes
nunit.core.dll!NUnit.Core.TestMethod.Run(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x19a bytes
nunit.core.dll!NUnit.Core.TestSuite.RunAllTests(NUnit.Core.TestResult suiteResult = {NUnit.Core.TestResult}, NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x48d bytes
nunit.core.dll!NUnit.Core.TestSuite.RunSuite(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x6f3 bytes
nunit.core.dll!NUnit.Core.TestSuite.RunSuiteInContext(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x8e bytes
nunit.core.dll!NUnit.Core.TestSuite.Run(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x11d bytes
nunit.core.dll!NUnit.Core.ParameterizedMethodSuite.Run(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x1fb bytes
nunit.core.dll!NUnit.Core.TestSuite.RunAllTests(NUnit.Core.TestResult suiteResult = {NUnit.Core.TestResult}, NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x48d bytes
nunit.core.dll!NUnit.Core.TestSuite.RunSuite(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x6f3 bytes
nunit.core.dll!NUnit.Core.TestSuite.RunSuiteInContext(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x8e bytes
nunit.core.dll!NUnit.Core.TestSuite.Run(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x11d bytes
nunit.core.dll!NUnit.Core.TestFixture.Run(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0xc5 bytes
nunit.core.dll!NUnit.Core.TestSuite.RunAllTests(NUnit.Core.TestResult suiteResult = {NUnit.Core.TestResult}, NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x48d bytes
nunit.core.dll!NUnit.Core.TestSuite.RunSuite(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x6f3 bytes
nunit.core.dll!NUnit.Core.TestSuite.RunSuiteInContext(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x8e bytes
nunit.core.dll!NUnit.Core.TestSuite.Run(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x11d bytes
nunit.core.dll!NUnit.Core.TestSuite.RunAllTests(NUnit.Core.TestResult suiteResult = {NUnit.Core.TestResult}, NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x48d bytes
nunit.core.dll!NUnit.Core.TestSuite.RunSuite(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x6f3 bytes
nunit.core.dll!NUnit.Core.TestSuite.RunSuiteInContext(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x8e bytes
nunit.core.dll!NUnit.Core.TestSuite.Run(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x11d bytes
nunit.core.dll!NUnit.Core.TestSuite.RunAllTests(NUnit.Core.TestResult suiteResult = {NUnit.Core.TestResult}, NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x48d bytes
nunit.core.dll!NUnit.Core.TestSuite.RunSuite(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x6f3 bytes
nunit.core.dll!NUnit.Core.TestSuite.RunSuiteInContext(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x8e bytes
nunit.core.dll!NUnit.Core.TestSuite.Run(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x11d bytes
nunit.core.dll!NUnit.Core.TestSuite.RunAllTests(NUnit.Core.TestResult suiteResult = {NUnit.Core.TestResult}, NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x48d bytes
nunit.core.dll!NUnit.Core.TestSuite.RunSuite(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x6f3 bytes
nunit.core.dll!NUnit.Core.TestSuite.RunSuiteInContext(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x8e bytes
nunit.core.dll!NUnit.Core.TestSuite.Run(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x11d bytes
nunit.core.dll!NUnit.Core.TestSuite.RunAllTests(NUnit.Core.TestResult suiteResult = {NUnit.Core.TestResult}, NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x48d bytes
nunit.core.dll!NUnit.Core.TestSuite.RunSuite(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x6f3 bytes
nunit.core.dll!NUnit.Core.TestSuite.RunSuiteInContext(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x8e bytes
nunit.core.dll!NUnit.Core.TestSuite.Run(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x11d bytes
nunit.core.dll!NUnit.Core.TestSuite.RunAllTests(NUnit.Core.TestResult suiteResult = {NUnit.Core.TestResult}, NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x48d bytes
nunit.core.dll!NUnit.Core.TestSuite.RunSuite(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x6f3 bytes
nunit.core.dll!NUnit.Core.TestSuite.RunSuiteInContext(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x8e bytes
nunit.core.dll!NUnit.Core.TestSuite.Run(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x11d bytes
nunit.core.dll!NUnit.Core.SimpleTestRunner.Run(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}, bool tracing = false, NUnit.Core.LoggingThreshold logLevel = Off) + 0x183 bytes
JetBrains.ReSharper.UnitTestRunner.nUnit.dll!JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestRunner.Run(NUnit.Core.EventListener listener = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitListener}, NUnit.Core.ITestFilter filter = {JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTestFilter}) + 0x90 bytes
JetBrains.ReSharper.UnitTestRunner.nUnit.dll!JetBrains.ReSharper.UnitTestRunner.nUnit.BuiltInNUnitRunner.RunTests(JetBrains.ReSharper.TaskRunnerFramework.IRemoteTaskServer server = {System.Runtime.Remoting.Proxies.__TransparentProxy}, System.Collections.Generic.Dictionary<string,JetBrains.ReSharper.TaskRunnerFramework.RemoteTask> tests = Count = 3, System.Collections.Generic.Dictionary<string,JetBrains.ReSharper.TaskRunnerFramework.RemoteTask> fixtures = Count = 1, System.Collections.Generic.List<string> explicitly = Count = 1, bool useAddins = false, System.Collections.Generic.List<string> assemblies = Count = 1) + 0x9f2 bytes
[Native to Managed Transition]
[Managed to Native Transition]
mscorlib.dll!System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage msg) + 0x405 bytes
mscorlib.dll!System.Runtime.Remoting.Messaging.ServerObjectTerminatorSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage reqMsg) + 0xc8 bytes
mscorlib.dll!System.Runtime.Remoting.Messaging.ServerContextTerminatorSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage reqMsg) + 0x16c bytes
mscorlib.dll!System.Runtime.Remoting.Channels.CrossContextChannel.SyncProcessMessageCallback(object[] args) + 0xce bytes
[Native to Managed Transition]
[Managed to Native Transition]
mscorlib.dll!System.Runtime.Remoting.Channels.CrossContextChannel.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage reqMsg = {System.Runtime.Remoting.Messaging.MethodCall}) + 0x113 bytes
mscorlib.dll!System.Runtime.Remoting.Channels.ChannelServices.SyncDispatchMessage(System.Runtime.Remoting.Messaging.IMessage msg = {System.Runtime.Remoting.Messaging.MethodCall}) + 0x158 bytes
mscorlib.dll!System.Runtime.Remoting.Channels.CrossAppDomainSink.DoDispatch(byte[] reqStmBuff, System.Runtime.Remoting.Messaging.SmuggledMethodCallMessage smuggledMcm, out System.Runtime.Remoting.Messaging.SmuggledMethodReturnMessage smuggledMrm) + 0xaa bytes
mscorlib.dll!System.Runtime.Remoting.Channels.CrossAppDomainSink.DoTransitionDispatchCallback(object[] args = {object[3]}) + 0x92 bytes
[Appdomain Transition]
mscorlib.dll!System.Runtime.Remoting.Channels.CrossAppDomainSink.DoTransitionDispatch(byte[] reqStmBuff, System.Runtime.Remoting.Messaging.SmuggledMethodCallMessage smuggledMcm, out System.Runtime.Remoting.Messaging.SmuggledMethodReturnMessage smuggledMrm) + 0xa0 bytes
mscorlib.dll!System.Runtime.Remoting.Channels.CrossAppDomainSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage reqMsg = {System.Runtime.Remoting.Messaging.Message}) + 0x15d bytes
mscorlib.dll!System.Runtime.Remoting.Proxies.RemotingProxy.CallProcessMessage(System.Runtime.Remoting.Messaging.IMessageSink ms, System.Runtime.Remoting.Messaging.IMessage reqMsg, System.Runtime.Remoting.Contexts.ArrayWithSize proxySinks, System.Threading.Thread currentThread, System.Runtime.Remoting.Contexts.Context currentContext, bool bSkippingContextChain) + 0x8c bytes
mscorlib.dll!System.Runtime.Remoting.Proxies.RemotingProxy.InternalInvoke(System.Runtime.Remoting.Messaging.IMethodCallMessage reqMcmMsg, bool useDispatchMessage, int callType) + 0x22c bytes
mscorlib.dll!System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(ref System.Runtime.Remoting.Proxies.MessageData msgData, int type) + 0x1f4 bytes
JetBrains.ReSharper.UnitTestRunner.nUnit.dll!JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTaskRunner.ExecuteRecursive(JetBrains.ReSharper.TaskRunnerFramework.TaskExecutionNode node = {JetBrains.ReSharper.TaskRunnerFramework.TaskExecutionNode}) + 0xfc0 bytes
JetBrains.ReSharper.TaskRunnerFramework.dll!JetBrains.ReSharper.TaskRunnerFramework.StartupTaskRunnerHost.Execute(JetBrains.ReSharper.TaskRunnerFramework.TaskExecutionNode node = {JetBrains.ReSharper.TaskRunnerFramework.TaskExecutionNode}) + 0x1f9 bytes
JetBrains.ReSharper.TaskRunnerFramework.dll!JetBrains.ReSharper.TaskRunnerFramework.StartupTaskRunnerHost.ExecuteNodes(System.Collections.Generic.IEnumerable<JetBrains.ReSharper.TaskRunnerFramework.TaskExecutionNode> nodes = Count = 1) + 0xa4 bytes
JetBrains.ReSharper.TaskRunnerFramework.dll!JetBrains.ReSharper.TaskRunnerFramework.TasksPacketHandler.ThreadProc(JetBrains.ReSharper.TaskRunnerFramework.TaskRunnerProxy proxy = {JetBrains.ReSharper.TaskRunnerFramework.TaskRunnerProxy}, System.Collections.Generic.IEnumerable<JetBrains.ReSharper.TaskRunnerFramework.RemoteTaskPacket> packets = Count = 1, JetBrains.ReSharper.TaskRunnerFramework.AssemblyLoader loader = {JetBrains.ReSharper.TaskRunnerFramework.AssemblyLoader}) + 0x139 bytes
JetBrains.ReSharper.TaskRunnerFramework.dll!JetBrains.ReSharper.TaskRunnerFramework.TasksPacketHandler.Accept.AnonymousMethod__1() + 0x4b bytes
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x285 bytes
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x9 bytes
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x57 bytes
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x51 bytes
[Native to Managed Transition]

最佳答案

在//build/2014 期间发布的当前预览版中,您需要执行以下操作:

var customWorkspace = new CustomWorkspace(new MefExportPack(catalog));

目录是 MEF 目录。您可以看到一些代码来构建目录 here .

自那次预览以来,我们已经 renamed a bunch of the types .如果您来自 future (欢迎过去的我!)并使用包含该更改的预览,请改为尝试此操作:

var customWorkspace = new CustomWorkspace(MefHostServices.Create(assemblies));

其中 assemblies 是您希望我们包含在 MEF 组合中的程序集的列表。您可以Assembly.Load 您关心的那些,在本例中为 Microsoft.CodeAnalysis.Workspaces.dll 和 Microsoft.CodeAnalysis.CSharp.Workspaces.dll。您可能还需要包括功能 DLL,具体取决于您正在做什么。

关于c# - 如何配置 Roslyn CustomWorkSpace 不为 Visual Basic 而哭泣?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23608457/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com