The M-Files Community will be updated on Tuesday, April 2, 2024 at 10:00 AM EST / 2:00 PM GMT and the update is expected to last for several hours. The site will be unavailable during this time.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

VAF - DLL missing at execution

Hello,

I have developed a Vault app which uses a nuget which requires a few more.

Everything is ok and the code is working in a console application. However, I have a runtime error in the M-Files vault when changing the workflow state that launches the code.

The BouncyCastle.Crypto DLL is apparently missing. However, it is in the .mfappx file

Has anyone seen a situation like this before? Can I copy the missing DLL by hand? I did not find in which directory.

Thank you in advance for your suggestions.

  • Hi, 

    Not quite sure how do you test it in console app. Vault apps have to be deployed into Vault (manually or with script, Applications and then install your mfappx bundle). I've used 3rd party dependencies (e.g. OpenXML) that are used on the runtime and it worked well actually. 

    If you have all dependencies in your mfappx and install it in Vault applications, it should actually work. Don't know how you create MFAPPX file, it is actually simple ZIP containing appdef.xml, so be sure you have that file too. If you use VIS template, you can very easily create proper mfappx but as mentioned you can zip your bin folder with all your dependencies and it should work then properly.

    The other thought is to verify your dependency is .NET framework compatible (until 4.8). VAF/M-Files does not support .NET Core/5+.

    Dejan

  • For testing, I create a console project and reference the M-Files VAF nuget. So I can use helpers like ObjVerEx or SearchBuilder.


    Other projects have also dependencies and works weel. I am indeed using the template for the Vault applications to create the .mfappx file

    The .Net version is 4.8 and the appdef.xml is present.

    The error message is:

    Could no load file or assembly 'BouncyCaslte.Crypto, Version = 1.8.9.0, Culture=neutral, PublicKeyToken=0e99375e54769942' or one of its dependencies. The system cannot find the file specified.

    Finally,  I have a myProject.dll.config file like this:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-1.8.10.0" newVersion="1.8.10.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="10.0.0.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /></startup></configuration>

  • The VAF isn't really designed this way, although it can be done.

    The problem appears to be within .NET rather than M-Files; it cannot find the DLL with that name/type.  I note that your error message has the assembly name misspelt.  Are you trying to lazy-load this, perhaps, and have some sort of typo?

  • FYI: the VAF does not support project configuration files.  If you are using these for binding redirection then you will instead need to use the AssemblyResolve event.

  • Hello,

    I misspelt it when copying from the screen capture. Sorry.

    Is M-Files sing a another version of this DLL?

  • It's not explicitly referenced by the VAF, but I assume that it's possible that the hosting process may use it.  I am on vacation this week so can't check, but I would look at the AssemblyResolve approach and see whether a different version is requested.

  • I'm suprised because I have anothers DLL that works but I will try this, thank you.

    Have you a quick example? Where to add function to the event, must I surcharge Initialization method of the vault application?

    Then I just add the DLL files to the project and it will do the trick?

  • The basic idea is this (the below reacts when Newtonsoft.Json 6 is requested and returns Newtonsoft.Json 10.0.3, but you can customise this):

    static VaultApplication()
    
                 {
    
                        AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
    
                        {
    
    switch (args.Name)
    
                              {
    
    // Force through Newtonsoft.Json to 10.0.3.
    
    case "Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed":
    
    case "Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed":
    
    return Assembly.Load("Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed");
    
                              }
    
    return null;
    
                        };
    
                 }

    You can use this to see what versions of what assemblies are requested, and you can return the available version of an assembly to override what was requested.  You return null for default behaviour.

    If you work for a reseller then you can request support via your CAM.  If you work for an end-user then you can request support via your reseller.  Note that this may be charged.

    Regards,

    Craig.

  • Hi,

    I am now back in the office and was able to do a little more research.

    I can't see that this DLL is used at our side (although my check may not have been perfect), so not sure what's going on.  Did you try the above approach?

    I can see that you work for a sub-reseller, so my suggestion would be to raise this with your reseller first.  If they can replicate the issue then they can raise it directly with us and we can set up a one-to-one support session with them.

    Regards,

    Craig.