如何配置Roslyn CustomWorkSpace不为Visual Basic而哭泣

本文关键字:Visual 不为 Basic CustomWorkSpace Roslyn 何配置 配置 | 更新日期: 2023-09-27 18:03:06

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

var workspace = new CustomWorkspace();

这一行抛出(并在内部处理)异常,如:

"无法加载文件或程序集"Microsoft.CodeAnalysis.VisualBasic。Version = 0.6.0.0工作区,文化=中性,PublicKeyToken=31bf3856ad364e35'或其之一依赖关系。系统找不到指定的文件。"

请注意,异常只有在调试器中运行代码时才可见,并将VS配置为只显示而不是未处理的异常。

我根本不想使用Visual Basic的特性。我已经检查了工作区构造函数重载,最有希望的一个是接受FeauterPack,但不幸的是

 public class CSharpWorkspaceFeatures : FeaturePack

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

我错过什么了吗?

Thanks in advance

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]  

如何配置Roslyn CustomWorkSpace不为Visual Basic而哭泣

在//build/2014期间发布的当前预览版中,您需要做的是:

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

,其中目录是MEF目录。您可以在这里看到一些构建目录的代码。

从预览版开始,我们已经重命名了一些类型。如果你来自未来(欢迎来自过去的我!)并且使用包含该更改的预览,请尝试以下方法:

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

,其中assemblies是您希望我们包含在MEF组合中的程序集的列表。这将取决于你Assembly.Load你关心的,在这种情况下,microsoft . codeanalysis . csharp . workspace .dll和microsoft . codeanalysis . csharp . workspace .dll。您可能还需要包含Features DLL,这取决于您正在做的事情。