System.ApplicationException: Vault element with the alias "xxxxx" is not found

Hi All, 

I have had a problem in the last couple of VAFs I have created where I am receiving an error saying that the Vault element with the alias "xxx" is not found. I cross check the vault structure and the alias is exists in the vault. I am wondering if there is any known causes for why my VAF cannot resolve an alias which exists in the vault?  Was not a problem for me previously, and I construct my VAFs in a similar fashion each time, just wondering what I am doing recently which might be causing this to happen.

If I replace the alias with the property ID, it all works fine. I am using VAF 2.3. 

Any insight would be appreciated. 

thanks!

Parents
  • I'm not aware of any issues. Are you able to share one of the configuration item declarations that fails? 

  • Hi Craig, thanks for your response. 

    The declaration of the MFIdentifiers of some of the properties which have failed as as follows.

    I am calling it in the Vault application as follows;

    As you can see the line where the error is being through is within the if statement which is confirming the supplier has a value so the supplier MFIdentifier is resolving. 

    The error message in Event viewer is as follows

    System.ApplicationException: Vault element with the alias "PD.GstRegistered" is not found.
    at MFiles.VAF.Configuration.MFIdentifier.op_Implicit(MFIdentifier identifier)
    at Upstream.InvoiceProcessing.WesternBuilding.VaultApplication.WF_Set_Initial_Values(StateEnvironment env) in C:\Users\adm_au123921\OneDrive - FUJIFILM\Development Server Share Folder\Visual Studio Projects\Upstream.InvoiceProcessing.WesternBuilding\VaultApplication.cs:line 122

  • Hi Andy,

    That's not how the configuration items are designed to work; you shouldn't need to instantiate anything.

    The concept is that you add properties and fields to your "configuration" class (this is the class referenced by your vault application class, in the "ConfigurableVaultApplicationBase<T>" line, where "T" is the configuration class).  If you do this then you can access those properties and fields via the "this.Configuration" reference inside your vault application.  MFIdentifier references defined here are automatically "resolved" as part of the startup process; it's this which is not happening in your case, so the ID is not available and it's throwing that error.

    An example:

    [DataContract]
    public class Configuration
    {
      [DataMember]
      [MFPropertyDef]
      public MFIdentifier MyPropertyDef { get; set; } = "App.PD.PropertyDefAlias";
    }
    
    public class VaultApplication
      : ConfigurableVaultApplicationBase<Configuration>
    {
      [MFEventHandler(...)]
      public void MyEventHandler(EventHandlerEnvironment env)
      {
        System.Diagnostics.Debug.WriteLine($"The property has ID {this.Configuration.MyPropertyDef.ID}");
      }
    }

    You can define the identifiers in other ways, but you would then need to make sure that you manually call the "resolve" method.  That's not generally the way I would guide you, though, as it means administrators can't change the application configuration easily and the like.

    Regards,

    Craig.

  • Hi Craig,

    Thank you for the detailed response! Makes sense. Appreciate it. 

    Regards,

Reply Children
No Data