Вызов IdentityServer3 для Autofa c `RegisterApiControllers ()` завершается неудачно в Mono 6.4+ с `TypeLoadException` - PullRequest
0 голосов
/ 18 февраля 2020

Мы уже некоторое время используем IdentityServer3 2.5.4 с Mono 4.8, работаем в Ubuntu и MacOS.

Мы обновились до Mono 6.6, и теперь при запуске мы получаем исключение:

System.TypeLoadException: Could not load type of field 
    'Microsoft.Owin.Security.DataProtection.DpapiDataProtector:_protector' (0) 
    due to: Could not resolve type with token 01000107 from typeref 
    (expected class 'System.Security.Cryptography.DpapiDataProtector' 
    in assembly 'System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') 
    assembly:System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 
    type:System.Security.Cryptography.DpapiDataProtector 
    member:(null)
  at (wrapper managed-to-native) System.RuntimeTypeHandle.type_is_assignable_from(System.Type,System.Type)
  at System.RuntimeTypeHandle.CanCastTo (System.RuntimeType type, System.RuntimeType target) [0x00000] in <285579f54af44a2ca048dad6be20e190>:0
  at System.RuntimeType.IsAssignableFrom (System.Type c) [0x00020] in <285579f54af44a2ca048dad6be20e190>:0
  at Autofac.Integration.WebApi.RegistrationExtensions.<RegisterApiControllers>b__0 (System.Type t) [0x00000] in <03d9eb8289e046799e444fc1f976e306>:0
  [...]
  at IdentityServer3.Core.Configuration.Hosting.AutofacConfig.Configure (IdentityServer3.Core.Configuration.IdentityServerOptions options) [0x004ef] in <03d9eb8289e046799e444fc1f976e306>:0

(отредактировано для удобства чтения).

Autofa c сканирует сборку IdentityServer3.dll, чтобы зарегистрировать ее контроллеры WebApi при обнаружении исключения.

Microsoft.Owin.Security.DataProtection.DpapiDataProtector является частным членом этой сборки (в соответствии с monop -p), и я думаю, поэтому он был найден при сканировании.

Я пробовал другие версии Mono между 4.8 и 6.6; это происходит только для Mono 6.4 и выше.

Другие версии:

  • Autofa c 3.5.2
  • Autofa c .Owin 3.1.0
  • Autofa c .WebApi2 3.4.0
  • Autofa c .WebApi2.Owin 3.3.0

Буду признателен за любые идеи о том, как решить эта проблема.

...