MissingMethodException w/ Mono

2020-04-12 11:41发布

I am aware that typically, MissingMethodException in Mono means that you are referencing a part of the framework that isn't implemented in Mono, even though it is available in the Microsoft .NET framework. However, in this case, I am receiving a MissingMethodException only referring to a method in my own code. However, it only occurs on Mono.

Since the exception doesn't contain any of my code until the missing method, I'm not even sure where to begin to look for the issue.

Here is the exception:

Unhandled Exception: System.MissingMethodException: Method not found: 'ParkingMapper.GeoHash.IndexGeoHash'.
  at (wrapper managed-to-native) System.Reflection.MonoMethodInfo:get_method_info (intptr,System.Reflection.MonoMethodInfo&)
  at System.Reflection.MonoMethodInfo.GetMethodInfo (IntPtr handle) [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\corlib\System.Reflect
ion\MonoMethod.cs:63
  at System.Reflection.MonoMethod.GetPseudoCustomAttributes () [0x00002] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\corlib\System.Reflection\M
onoMethod.cs:295
  at System.MonoCustomAttrs.GetPseudoCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType) [0x0000d] in C:\cygwin\tmp\monobuild\build\BUILD
\mono-2.10.1\mcs\class\corlib\System\MonoCustomAttrs.cs:68
  at System.MonoCustomAttrs.IsDefined (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit) [0x00039] in C:\cygwin\tmp\monobuild\build\BUIL
D\mono-2.10.1\mcs\class\corlib\System\MonoCustomAttrs.cs:291
  at System.Reflection.MonoMethod.IsDefined (System.Type attributeType, Boolean inherit) [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\
corlib\System.Reflection\MonoMethod.cs:276
  at Microsoft.Internal.AttributeServices.IsAttributeDefined[ExportAttribute] (ICustomAttributeProvider attributeProvider, Boolean inherit) [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\System.ComponentModel.Composition\src\ComponentModel\Microsoft\Internal\AttributeServices.cs:40
  at System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.IsExport (ICustomAttributeProvider attributeProvider) [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\System.ComponentModel.Composition\src\ComponentModel\System\ComponentModel\Composition\AttributedModel\AttributedPartCreationInfo.cs:355
  at System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo+<GetExportMembers>c__Iterator0.MoveNext () [0x001b5] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\System.ComponentModel.Composition\src\ComponentModel\System\ComponentModel\Composition\AttributedModel\AttributedPartCreationInfo.cs:304
  at System.Linq.Enumerable.Any[MemberInfo] (IEnumerable`1 source) [0x00024] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\System.Core\System.Linq\Enumerable.cs:136
  at System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.HasExports () [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\System.ComponentModel.Composition\src\ComponentModel\System\ComponentModel\Composition\AttributedModel\AttributedPartCreationInfo.cs:106
  at System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.IsPartDiscoverable () [0x0003a] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\System.ComponentModel.Composition\src\ComponentModel\System\ComponentModel\Composition\AttributedModel\AttributedPartCreationInfo.cs:95
  at System.ComponentModel.Composition.AttributedModel.AttributedModelDiscovery.CreatePartDefinitionIfDiscoverable (System.Type type, ICompositionElement origin) [0x0000a] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\System.ComponentModel.Composition\src\ComponentModel\System\ComponentModel\Composition\AttributedModel\AttributedModelDiscovery.cs:19
  at System.ComponentModel.Composition.Hosting.TypeCatalog.get_PartsInternal () [0x00051] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\System.ComponentModel.Composition\src\ComponentModel\System\ComponentModel\Composition\Hosting\TypeCatalog.cs:166
  at System.ComponentModel.Composition.Hosting.TypeCatalog.CreateIndex () [0x0000b] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\System.ComponentModel.Composition\src\ComponentModel\System\ComponentModel\Composition\Hosting\TypeCatalog.cs:263
  at System.Lazy`1[System.Collections.Generic.IDictionary`2[System.String,System.Collections.Generic.List`1[System.ComponentModel.Composition.Primitives.ComposablePartDefinition]]].InitValue () [0x0014f] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.1\mcs\class\corlib\System\Lazy.cs:155

1条回答
贪生不怕死
2楼-- · 2020-04-12 12:23

Got it! It seems MEF in Mono doesn't like a DirectoryCatalog that references DLLs with no exports. I was pointing at the current assembly directory, which is a no-no in Mono.

查看更多
登录 后发表回答