简体   繁体   中英

MSBuildWorkspace.Create on mono throws ReflectionTypeLoadException

The following works on vanilla .NET but throws a ReflectionTypeLoadException when I try to run it through mono:

var props = new Dictionary<string, string>();
props["CheckForSystemRuntimeDependency"] = "true";
using (var msWorkspace = MSBuildWorkspace.Create(props))
{
   ...

Exception is:


System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
  at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in :0
  at System.Reflection.Assembly+<>c__Iterator0.MoveNext () [0x00000] in :0
  at System.Linq.Enumerable+c__Iterator102[System.Reflection.TypeInfo,System.Type].MoveNext () [0x00000] in <filename unknown>:0 at System.Linq.Enumerable+<CreateSelectManyIterator>c__Iterator122[System.Reflection.Assembly,System.Type].MoveNext () [0x00000] in :0
  at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor (IEnumerable1 types, System.Composition.Convention.AttributedModelProvider attributeContext) [0x00000] in <filename unknown>:0 at System.Composition.Hosting.ContainerConfiguration.CreateContainer () [0x00000] in <filename unknown>:0 at Microsoft.CodeAnalysis.Host.Mef.MefHostServices.Create (IEnumerable1 assemblies) [0x00000] in :0
  at Microsoft.CodeAnalysis.Host.Mef.DesktopMefHostServices.get_DefaultServices () [0x00000] in :0
  at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.Create (IDictionary`2 properties) [0x00000] in :0

...

Is this a known problem?

对我来说,它有助于将所有Linq。*库手动添加到项目中

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM