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 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.

  • I confirmed that all the references are up to date and the framework is set to 4.7.2 However, I notice warnings that there are several package versions outside of the dependency constraint driven by vaultApplications.Logging on 22.5.136.  Could this be related to the problem.

    uninstalled and reinstalled vaultApplications.Logging but it made no difference to the formattableString error.

  • If you are using the latest versions of everything then you should not need the separate logging package; that was for older VAF versions.  Details here: Logging in the Vault Application Framework

  • Excellent. That has done the trick.  Making progress.

  • 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));
    }

    Also this worries me a little.  The logger should be added as an instance member to the class that's doing logging, not to a general "logclass" class.  I hope that's maybe some pseudo-code.

  • I removed the LogClass, can completed the logging change over (I think successfully)

    However, the following error is beating me.  I suspect that it has to do with changes in the VaultExtensionMethod but I cannot identify what I am doing wrong.  Below is the error and the code for on of the extension methods 

    Error

    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 3277
    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 2889
    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 3005
    at MFiles.VAF.VaultApplicationBase.RegisterMethodsFromSource(IMethodSource source, Vault vault) in K:\GRB\HHaVvdJo\0\libraries\vaf\src\MFiles.VAF\Core\VaultApplicationBase.cs:line 2810
    at MFiles.VAF.VaultApplicationBase.LoadHandlerMethods(Vault vault) in K:\GRB\HHaVvdJo\0\libraries\vaf\src\MFiles.VAF\Core\VaultApplicationBase.cs:line 2744
    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 1810
    at MFiles.VAF.VaultApplicationBase.Initialize(Vault vaultSrc) in K:\GRB\HHaVvdJo\0\libraries\vaf\src\MFiles.VAF\Core\VaultApplicationBase.cs:line 1350

    -----------------------

    Extension Method example


    [VaultExtensionMethod("GetPerformActionOnSelectedObjectForSynchProcess", RequiredVaultAccess = MFVaultAccess.MFVaultAccessNone)]
    private string GetPerformActionOnSelectedObjectForSynchProcess(EventHandlerEnvironment env)
    {
    //System.Diagnostics.Debugger.Launch();
    try
    {
    string Result = string.Empty;
    ActionItems objActionItems = GetActionItems(env);
    string ConStr = objConConfig.GetConnectionString(env, base.Configuration);
    Menu ObjMenu = new Menu();
    if (base.Configuration.WebApiDetails != null && !string.IsNullOrEmpty(base.Configuration.WebApiDetails.ApiURL))
    {
    ContextMenuService.ApiUrl = base.Configuration.WebApiDetails.ApiURL + (base.Configuration.WebApiDetails.ApiURL.EndsWith("/") ? "" : "/");
    ContextMenuService.JWTToken = ContextMenuService.GetToken(objConConfig.GetApiCredentials(base.Configuration), ContextMenuService.GetJWTToken());
    HandleActionTask(env, objActionItems);
    }
    else
    {
    HandleActionTask(env, objActionItems);
    }
    }
    catch (Exception ex)
    {
    this.Logger.Error(ex, $"Error:{ex.Message}");
    throw;
    }
    return Result.Replace("\\n", "\n");
    }

  • no worries, I found a rough extensionmethod with an additional parameter. all resolved. it loaded the package. 

Reply Children
No Data