signature or security transparency is not compatible with that of the delegate type

We are experiencing the following error and have not been able to resolve it.  Previous references to this in the forum was applied but it till have not resolved the issue.  Not sure what to look at next to isolate the issue

Notably, then extension methods are running in async mode; versions 24.1.64.0 of the extension methods and 24.1.706.2 of the VAF are used; 

The VaultApplicationBase is included with  : MFiles.VAF.Extensions.ConfigurableVaultApplicationBase<Configuration>, ICustomLogger/* VaultApplicationWithSecureConfigurationBase<Configuration>*/

would appreciate some support to get past this.

System.ArgumentException: Cannot bind to the target method because its signature or security transparency is not compatible with that of the delegate type.
at System.Delegate.CreateDelegate(Type type, Object firstArgument, MethodInfo method, Boolean throwOnBindFailure)
at System.Delegate.CreateDelegate(Type type, Object firstArgument, MethodInfo method)
at MFiles.VAF.VaultExtensionMethodInfo..ctor(MethodInfo methodInfo, Object instance, MFVaultAccess requiredVaultAccess, Boolean hasSeparateEventHandlerProxy, EventHandlerVaultUserIdentity vaultUserIdentity, MFEventHandlerType eventHandlerType) in K:\GRB\HHaVvdJo\0\libraries\vaf\src\MFiles.VAF\Core\MethodInfo.cs:line 381
at MFiles.VAF.VaultApplicationBase.CreateVaultExtensionMethodInfo(MethodInfo methodInfo, Object instance, VaultExtensionMethodAttribute attribute) in K:\GRB\HHaVvdJo\0\libraries\vaf\src\MFiles.VAF\Core\VaultApplicationBase.cs:line 3270
at MFiles.VAF.VaultApplicationBase.RegisterVaultExtensionMethodHandler(MethodInfo method, Object instance, Vault vault) in K:\GRB\HHaVvdJo\0\libraries\vaf\src\MFiles.VAF\Core\VaultApplicationBase.cs:line 2882
at MFiles.VAF.VaultApplicationBase.RegisterHandlers[T](IMethodSource source, Action`3 registerAction, Vault vault) in K:\GRB\HHaVvdJo\0\libraries\vaf\src\MFiles.VAF\Core\VaultApplicationBase.cs:line 2998
at MFiles.VAF.VaultApplicationBase.RegisterMethodsFromSource(IMethodSource source, Vault vault) in K:\GRB\HHaVvdJo\0\libraries\vaf\src\MFiles.VAF\Core\VaultApplicationBase.cs:line 2803
at MFiles.VAF.VaultApplicationBase.LoadHandlerMethods(Vault vault) in K:\GRB\HHaVvdJo\0\libraries\vaf\src\MFiles.VAF\Core\VaultApplicationBase.cs:line 2737
at MFiles.VAF.Extensions.ConfigurableVaultApplicationBase`1.LoadHandlerMethods(Vault vault)
at MFiles.VAF.VaultApplicationBase.InitializeImpl(Vault vault) in K:\GRB\HHaVvdJo\0\libraries\vaf\src\MFiles.VAF\Core\VaultApplicationBase.cs:line 1823
at MFiles.VAF.VaultApplicationBase.Initialize(Vault vaultSrc) in K:\GRB\HHaVvdJo\0\libraries\vaf\src\MFiles.VAF\Core\VaultApplicationBase.cs:line 1346

Parents
  • Notably, then extension methods are running in async mode; versions 24.1.64.0 of the extension methods and 24.1.706.2 of the VAF are used; 

    The method signature for entry points - such as extension methods - must match exactly those described in the developer portal and elsewhere.  The async keyword changes the method signature and fundamentally changes how these functions work; they are not currently supported.

  • after rolling back to a version that build and install the VAF package, I have reapplied the changes we are making to allow for logging, and it seems that these changes is causing the issue with installing the package.  Below is the sections of the code where we changed the methods.  Could you review and highlighted wat are we doing wrong.

    Defining the logger variables

    public class Menu
    {
    private readonly ICustomLogger _customLogger;
    public Menu(ICustomLogger customLogger)
    {
    _customLogger = customLogger;
    }
    public void LogDebug(string functionName, string message)
    {
    objLogModel = new LoggerModel();
    objLogModel.FunctionName = functionName;
    objLogModel.LogType = (int)LoggerType.Debug;
    _customLogger.Log(objLogModel);
    }

    public void LogException(string functionName, Exception ex, string message)
    {
    objLogModel = new LoggerModel();
    objLogModel.FunctionName = functionName;
    objLogModel.Exception = ex;
    objLogModel.Message = ex.Message;
    objLogModel.LogType = (int)LoggerType.Fatal;
    _customLogger.Log(objLogModel);
    }

    ...............................

    using the log class

    public string GetContextMenu(Vault V, int CurrentUserID, DataTable dtMenu)
    {

    string output = string.Empty;
    try
    {
    // string ProcName = "spMFGetContextMenu";
    //DataTable dtMenu = GetData(ProcName, Constr);
    if (dtMenu.Rows.Count > 0)
    {


    for (int i = 0; i < dtMenu.Rows.Count; i++)
    {

    IDs Members = V.UserGroupOperations.GetUserGroup(Convert.ToInt32(dtMenu.Rows[i]["UserGroupID"])).Members;
    if (Members.Count > 0)
    {
    foreach (var item in Members)
    {
    if (Convert.ToInt32(item) < 0)
    {
    if (CheckUserGroupContextMenuAccess(CurrentUserID, Convert.ToInt32(item) * -1, V))
    {
    output = output + GetContextMenuString(dtMenu, i);
    break;
    }
    }
    else
    {
    if (Convert.ToInt32(item) == CurrentUserID)
    {
    output = output + GetContextMenuString(dtMenu, i);
    break;
    }
    }

    }
    }

    }

    return output;
    }
    }
    catch (Exception ex)
    {
    LogException(nameof(GetContextMenu), ex, ex.Message);
    }
    return output;

    }

    .................

    adding the customLogger to the extensionmethod

    [VaultExtensionMethod("PerformActionMethod", RequiredVaultAccess = MFVaultAccess.MFVaultAccessNone)]
    private string PerformActionMethod(EventHandlerEnvironment env, ICustomLogger customLogger)
    {
    //System.Diagnostics.Debugger.Launch();
    try
    {
    ActionItems objActionItems = GetActionItems(env, customLogger);
    if (!string.IsNullOrEmpty(objActionItems.ContextMenu.ActionName))
    {
    HandleActionTask(env, objActionItems);
    }
    else
    {
    Result = "Procedure not found";
    }
    }
    catch (Exception ex)
    {
    objLogModel = new LoggerModel();
    objLogModel.FunctionName = "PerformActionMethod";
    objLogModel.Message = ex.Message;
    objLogModel.Exception = ex;
    objLogModel.LogType = (int)LoggerType.Fatal;
    Log(objLogModel);
    }
    return Result;
    }
    }
    }

  • The method signature with the vault extension method attribute must match the expected signature. The expected signature is here: https://developer.m-files.com/Frameworks/Vault-Application-Framework/Attributes/Vault-Extension-Methods/

    You cannot just add a logger parameter.

    If also recommend using the built-in logging mechanisms for better compatibility with things like the cloud. 

  • I removed/commented out all the code using the old style logging and checked that VAF builds and load.  I then added the code to use the built-in logging method.  When I add the code 

    private ILogger Logger { get; } = LogManager.GetLogger(typeof(LogClass));

    then the  error appears

    The LogClass is as follows

    using MFiles.VaultApplications.Logging;

    namespace ContextMenuVaultApp
    {
    public class LogClass
    {
    private ILogger Logger { get; } = LogManager.GetLogger(typeof(LogClass));
    }

    }

    ERROR

    DlgClientApplications.cpp, 537, Starting the application "MFSQL Connector VaultApp (5.0.2.4)" failed. (0x80040120)
    Item_DocumentVault.cpp, 1732, Starting the application "MFSQL Connector VaultApp (5.0.2.4)" failed. (0x80040120)
    IRPCClientScript.generated.cpp, 1505, Starting the application "MFSQL Connector VaultApp (5.0.2.4)" failed. (0x80040120)
    gRPCClient.cpp, 497, Starting the application "MFSQL Connector VaultApp (5.0.2.4)" failed. (0x80040120)
    gRPCClient.cpp, 466, Starting the application "MFSQL Connector VaultApp (5.0.2.4)" failed. (0x80040120)
    gRPCClient.cpp, 99, Starting the application "MFSQL Connector VaultApp (5.0.2.4)" failed. (0x80040120)
    gRPC.generated.cpp, 2237, Starting the application "MFSQL Connector VaultApp (5.0.2.4)" failed. (0x80040120)
    RPCClientScript.cpp, 390, Starting the application "MFSQL Connector VaultApp (5.0.2.4)" failed. (0x80040120)
    RPCClientScriptHelper.cpp, 708, Starting the application "MFSQL Connector VaultApp (5.0.2.4)" failed. (0x80040120)
    RPCClientScriptHelper.cpp, 1360, Starting the application "MFSQL Connector VaultApp (5.0.2.4)" failed. (0x80040120)
    RPCClientScriptHelper.cpp, 2052, Starting the application "MFSQL Connector VaultApp (5.0.2.4)" failed. (0x80040120)
    ExtensionManager_Legacy.cpp, 1078, Starting the application "MFSQL Connector VaultApp (5.0.2.4)" failed. (0x80040120)
    ExtensionManager_Legacy.cpp, 1078, Exception has been thrown by the target of an invocation. (0x80131604)
    ExtensionManager_Legacy.cpp, 1211, Exception has been thrown by the target of an invocation. (0x80131604)
    ExtObjectPlatform_Legacy.cpp, 242, Exception has been thrown by the target of an invocation. (0x80131604)
    ExtObjectPlatform_Legacy.cpp, 610, Exception has been thrown by the target of an invocation. (0x80131604)
    CoMFAppPlatform.cpp, 320, Exception has been thrown by the target of an invocation. (0x80131604)
    CoDynamicCLRObjectWrapper.cpp, 137, Exception has been thrown by the target of an invocation. (0x80131604)
    ManagedError.cpp, 152, Exception has been thrown by the target of an invocation. (0x80131604)
    mscorlib: [CManagedError* CRuntimeObjectWrapper.InitAndCreateObject(CRuntimeObjectWrapper*, CManagedError*, Char**, Char**)], IL:52, Exception has been thrown by the target of an invocation. (0x80131604)
    mscorlib: [System.Object CreateInstance(System.Type)], IL:0, Exception has been thrown by the target of an invocation. (0x80131604)
    mscorlib: [System.Object CreateInstance(System.Type, Boolean)], IL:58, Exception has been thrown by the target of an invocation. (0x80131604)
    mscorlib: [System.Object CreateInstanceSlow(Boolean, Boolean, Boolean, System.Threading.StackCrawlMark ByRef)], IL:106, Exception has been thrown by the target of an invocation. (0x80131604)
    mscorlib: [System.Object CreateInstance(System.RuntimeType, Boolean, Boolean, Boolean ByRef, System.RuntimeMethodHandleInternal ByRef, Boolean ByRef)], IL:-1, Exception has been thrown by the target of an invocation. (0x80131604)
    VaultApplication.cs, 52 (IL:18), The type initializer for 'MFiles.VaultApplications.Logging.LogManager' threw an exception. (0x80131534)
    MFiles.VaultApplications.Logging: [MFiles.VaultApplications.Logging.ILogger GetLogger(System.Type, MFiles.VaultApplications.Logging.ILoggingContext)], IL:0, The type initializer for 'MFiles.VaultApplications.Logging.LogManager' threw an exception. (0x80131534)
    MFiles.VaultApplications.Logging: [Void .cctor()], IL:5, Could not load type 'System.FormattableString' from assembly 'MFiles.VAF.Configuration, Version=25.3.14681.4, Culture=neutral, PublicKeyToken=fa007b370d17fe5e'. (0x80131522)
    MFiles.VaultApplications.Logging: [Void UpdateConfiguration(MFiles.VaultApplications.Logging.NLog.NLogLoggingConfiguration)], IL:-1, Could not load type 'System.FormattableString' from assembly 'MFiles.VAF.Configuration, Version=25.3.14681.4, Culture=neutral, PublicKeyToken=fa007b370d17fe5e'. (0x80131522)
    (M-Files 25.2.14524.3 2025-03-31T05:47:16.378Z)

  • This is something different.  What version of the dotnet framework are you targeting?  Make sure you're targeting 4.7.2 or higher.

  • the targeted version is 4.7.2

    How can I debug or isolate this error?

  •  Still trying to resolve "Reference to type 'FormattableString' claims it is defined in 'MFiles.VAF.Configuration', but it could not be found"

    on this.Logger.Error(ex,  $"Error:{ex.Message}");

    in the definition it shows that it is referencing ILogger which is referencing VaultApplications.Logging so where does it find the notion that it is trying to use MFiles.VAF.Configuration

  • If you are using the latest versions of everything then the FormattableString stuff shouldn't be referenced from these components, as they're defined already inside the dotnet base class library.  The older versions of the VAF Configuration had an implementation of this so that it could run in older versions of the dotnet runtime, but newer versions have a minimum of .net Framework 4.7.2 so it can reference it there.

Reply
  • If you are using the latest versions of everything then the FormattableString stuff shouldn't be referenced from these components, as they're defined already inside the dotnet base class library.  The older versions of the VAF Configuration had an implementation of this so that it could run in older versions of the dotnet runtime, but newer versions have a minimum of .net Framework 4.7.2 so it can reference it there.

Children