Menu

Once unity container is added IEMPL binder class initialization giving an error - "The invoked member is not supported in dynamic assembly"

Help
Kavita
2014-03-25
2014-04-01
  • Kavita

    Kavita - 2014-03-25

    Hi,

    Once code for unity container is added after that, following IEMPL initialization start giving an error.

    ie = new IEImpl(CSharpBinderFactory.LoadFromFile("TestingOne.EmployeeBinder", ruleBaseFile + ".ccb"));

    Debugged the NxBRE code and found the error on line 301 in source/util/compilation.cs, code is as below

    if ((ReferenceLinkMode == ReferenceLinkModes.CurrentDomain) || (ReferenceLinkMode == ReferenceLinkModes.Full)) {
    foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) {
    // do not add AssemblyBuilders (bug 1482753), thanks to Bob Brumfield
    if (!(assembly is AssemblyBuilder)) {
    AddReferencedAssembly(compilerParameters, assembly.Location);
    if(assembly.ManifestModule.ScopeName.Equals(NXBRE_DLL)) nxbreAssemblyLoaded = true;
    }
    }
    }

    There when it loops through the assesmbly, it gets broken on assembly "Anonymously hosted dynamic assembly" as it does not found the location of that.

    No idea if it is because of unity or anything else.

    Thanks in advance.

    Regards,
    Kavita Shinde

     

    Last edit: Kavita 2014-03-25
  • Kavita

    Kavita - 2014-03-25

    Hi,

    As debugged through the NxBRE code, if assembly.IsDynamic check added in LoadClass() method of source/util/compilation.cs, code is as below

    foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) {
    // do not add AssemblyBuilders (bug 1482753), thanks to Bob Brumfield
    if (!(assembly is AssemblyBuilder) && !(assembly.IsDynamic)) {
    AddReferencedAssembly(compilerParameters, assembly.Location);
    if(assembly.ManifestModule.ScopeName.Equals(NXBRE_DLL)) nxbreAssemblyLoaded = true;
    }

    Then it works fine, we need to have dynamic check as any dynamic code gets added which will not have any location to load it.

    With this check, one more problem has been solved also, which I had reported earlier, link to this is as follows.
    https://sourceforge.net/p/nxbre/discussion/339175/thread/4c6c08ac

    Is this anything to do with the following bug as mentioned the ID-1482753 in code as follows:
    https://sourceforge.net/p/nxbre/bugs/15/

    Please throw some light on this.

    Thanks,
    Kavita

     

    Last edit: Kavita 2014-03-25
  • David Dossot

    David Dossot - 2014-03-29

    Thanks a lot for looking into this.

    I was about to include your fix in the code base but I then realized that you don't appear to be using the latest version.

    The line you've changed is not 301 anymore but instead: https://github.com/ddossot/NxBRE/blob/master/NxBRE3/Source/Util/Compilation.cs#L319

    Please get the latest version of the source from https://github.com/ddossot/NxBRE and build NxBRE from it, then try again. If the problem still occurs then I'll add && !(assembly.IsDynamic) to the condition on line 319.

    Also please report further issues to https://github.com/ddossot/NxBRE/issues

    Thanks!

     
  • Kavita

    Kavita - 2014-04-01

    Hi David,

    Thanks a lot for the update, this seems to be working with the latest code.

    Regards,
    Kavita

     

Log in to post a comment.