Content Management and Capture

 View Only
  • 1.  Datacap C# Custom Actions Template not working

    Posted 17 days ago
    We are currently awaiting our new servers to be set up so that we can switch from 9.1.5 to 9.1.9.  This is due to begin within 4-5 weeks.  We have a lot of custom code that we have accumulated over the years using VBScript.  I now have a project that necessitates us going ahead and starting to switch over to creating custom actions using the C# project template provided in the software developer kit.
     
    I have been able to successfully create a new custom code project, and all of the dlls are referenced and it builds and creates a dll and there are no errors.  The dll is placed in our rules folder.  When I add the sample custom action to a function in Datacap Studio, it turns red and throws that popup box that says some actions do not match RRX specifications. I attached a screenshot of the message and the other pertinent parts of the screen.  If I ignore that message and save the ruleset and run the task, it says basically that it can't load the needed object:  <net>.  
     
    That brings me to when I first created the project.  It would not compile until I added <net>  near the top of the file named TheRRX.rrx.  The template was missing the open <net> tag but had the close </net> tag.  
     
    I am going to upload the project.  Please advise how I can get this sample custom action to work correctly.  


    ------------------------------
    Danny Mann
    ------------------------------


  • 2.  RE: Datacap C# Custom Actions Template not working
    Best Answer

    Posted 16 days ago

    Hi Danny Mann,

    you need to edit the "TheRRX.rrx" as well. Most importantly the parameters of the function don't match what is described in TheRRX, which is full with example parameters.

    The reason the '<net>' was missing ist because it should have an attribute 'ref' that match your namespace and class. There is a comment in that file right below your '<net>' describing the format: '<net ref="CustomActionsVScan.SampleAction">'

    Best Regards
    Julian



    ------------------------------
    Julian Fiegenbaum | ISR Information Products AG | Consultant | Germany
    ------------------------------



  • 3.  RE: Datacap C# Custom Actions Template not working

    Posted 16 days ago

    Thank you so much for information Julian.  After adding the ref= CustomActionsVScan.SampleAction to the opening <net> tag the errors in Datacap Studio went away.  Now I am getting something else in the task log when the action is being executed.  There is not much info to go on in the log, but just curious if you have a thought on it.  The log entry is below:

     

    07:36:52.707 (0)   t:25C p:1A8B300                Loading CustomActionsVScan.SampleAction as assembly from: \\DataCap\BCBSAR_VScan\dco_BCBSAR_VScan\rules\

    07:36:52.754 (47) t:25C p:1A8B300 \\DataCap\BCBSAR_VScan\dco_BCBSAR_VScan\rules\CustomActionsVScan.dll. AssemblyVersion: 9.1.5.0. AssemblyFileVersion: 9.1.5.1.

    07:36:52.754 (0)   t:25C p:1A8B300                call "CustomActionsVScan.SampleAction->CustomActionsVScan.SampleAction->CustomAction1"

    07:36:52.770 (16) t:25C p:1A8B300                /call

    07:36:52.770 (0)   t:25C p:1A8B300             /action

    07:36:52.770 (0)   t:25C p:1A8B300          /func

    07:36:52.770 (0)   t:25C p:1A8B300       /rule

    07:36:52.770 (0)   t:25C p:1A8B300    /dco

    07:36:52.770 (0)   t:25C p:1A8B300 /ruleset

    07:36:52.770 (0)   t:25C p:1A8B300 Error (-2147352567=hex:80020009). In CCom::Call: Action execution failed: object [CustomActionsVScan.SampleAction] method [CustomAction1] [api source:]

     

    07:36:52.770 (0)   t:25C p:1A8B300 EXCEPTION: code="-2147352567" msg="Action execution failed: object [CustomActionsVScan.SampleAction] method [CustomAction1]" loc="CCom::Call" API=""

     

    Any thoughts on it are greatly appreciated.

     

     


    Hi Danny Mann, you need to edit the "TheRRX.rrx" as well. Most importantly the parameters of the function don't match what is described in...






  • 4.  RE: Datacap C# Custom Actions Template not working

    Posted 15 days ago

    Hi Danny,

    just to be sure - since you didnt mention it: Did you edit the function parameters of your custom action in TheRRX? The example template features one argument of every data type and that will of course not fit your actual action.

    I had that Error (-2147352567=hex:80020009) several times. It is just a net-error code of mismatched datatypes iirc. The above can absolutely cause that one, when the com call tries to cast non-existent parameters.
    As a second measure you could make sure there are no uncaught exceptions in your custom code; NullReferences in particular.

    Regards Julian



    ------------------------------
    Julian Fiegenbaum | ISR Information Products AG | Consultant | Germany
    ------------------------------



  • 5.  RE: Datacap C# Custom Actions Template not working

    Posted 15 days ago

    Thank you for the reply.  I was just about to post and update to what I have tried.  I made a copy of the sample CustomAction1 and removed all parameters in the "TheRRX" file.  I removed all code from the action and and just added a line to have it just write something to the log.  That was successful.  I added one parameter back in and it was still successful.  Then I started adding code back to the new action from the sample action one piece at a time.  I am able to utilize things like CurrentDCO.something.  However, I narrowed it down to not being able to do this from the sample code:

    localSmartObj = new dcSmart.SmartNav(this);

    That is something that is necessary when passing smart parameters to the action.  That is something that I need to be working.  Any ideas would be very much appreciated as it gives no errors.  My code is below:

            public bool TestOneParameter(string p1)
            {
                WriteLog("p1 = " + p1);
                bool bRes = true;
                dcSmart.SmartNav localSmartObj = null;
     
                try
                {
                    WriteLog("Inside Try Branch.");
     
                    // the below 3 lines will not work
                    localSmartObj = new dcSmart.SmartNav(this); 
                    string smartP1 = localSmartObj.MetaWord(p1);
                    WriteLog("smartP1 = " + smartP1);
                    //the above 3 lines are the issue
     
                    if (CurrentDCO.ObjectType() == Level.Batch)
                    {
                        WriteLog("Batch Level");
                    }
                }
                catch (Exception ex)
                {
                    WriteLog("There was an exception: " + ex.Message);
                }
                //localSmartObj = null;
                return bRes;
            }



    ------------------------------
    Danny Mann
    ------------------------------



  • 6.  RE: Datacap C# Custom Actions Template not working

    Posted 15 days ago

    Hi Danny,

    so what is in the log? "There was an exception:..." or "smartP1 = ...". One of them has to be there, or there is something fundamentally broken. What is p1 and does it actually evaluate to a string when resolved? 

    In case of exception: What is the message? Maybe also log the exception type, if there is no proper message. Do we crash when the new SmartNav object is created? Or one line below when we try to resolve it?

    In case of failed resolve: Is smartP1 null or just empty?



    ------------------------------
    Julian Fiegenbaum | ISR Information Products AG | Consultant | Germany
    ------------------------------



  • 7.  RE: Datacap C# Custom Actions Template not working

    Posted 15 days ago

    If I have this line in the action:  localSmartObj = new dcSmart.SmartNav(this); (with or without the next 2 lines)

    it does not print anything at all from inside the action to the log.  It prints this error as when I first reported it which is below: 

    09:04:56.190 (0) t:258 p:233BD10             calling action TestOneParameter (str="Test Input Parameter String") on B:20240138.010
    09:04:56.190 (0) t:258 p:233BD10                execute statement On Action Start
    09:04:56.190 (0) t:258 p:233BD10                   nothing to exec
    09:04:56.190 (0) t:258 p:233BD10                /execute statement On Action Start
    09:04:56.190 (0) t:258 p:233BD10                Loading CustomVScan.CustomActions as assembly from: \\ecmspfilshare\ECMTest\ECMDev\DataCap\BCBSAR_VScan\dco_BCBSAR_VScan\rules\
    09:04:56.236 (47) t:258 p:233BD10 \\ecmspfilshare\ECMTest\ECMDev\DataCap\BCBSAR_VScan\dco_BCBSAR_VScan\rules\CustomVScan.dll. AssemblyVersion: 9.1.5.0. AssemblyFileVersion: 9.1.5.1.
    09:04:56.236 (0) t:258 p:233BD10                call "CustomVScan.CustomActions->CustomVScan.CustomActions->TestOneParameter"
    09:04:56.268 (31) t:258 p:233BD10                /call
    09:04:56.268 (0) t:258 p:233BD10             /action
    09:04:56.268 (0) t:258 p:233BD10          /func
    09:04:56.268 (0) t:258 p:233BD10       /rule
    09:04:56.268 (0) t:258 p:233BD10    /dco
    09:04:56.268 (0) t:258 p:233BD10 /ruleset
    09:04:56.268 (0) t:258 p:233BD10 Error (-2147352567=hex:80020009). In CCom::Call: Action execution failed: object [CustomVScan.CustomActions] method [TestOneParameter] [api source:]
     
    09:04:56.268 (0) t:258 p:233BD10 EXCEPTION: code="-2147352567" msg="Action execution failed: object [CustomVScan.CustomActions] method [TestOneParameter]" loc="CCom::Call" API=""

    If I take the localSmartObj and the next 2 lines out, It prints all of the expected values to the log with no issues.

    The localSmartObj = new dcSmart.SmartNav(this); is the issue, but I don't have any information on why or what to do about it.



    ------------------------------
    Danny Mann
    ------------------------------



  • 8.  RE: Datacap C# Custom Actions Template not working

    Posted 11 days ago

    Hi Danny,

    that sounds like the dcsmart dependency can not be properly resolved at runtime. It should normally be found under .../Datacap/dcshared/NET and check whether it is the same version as the one you used to compile. Also make sure that there are no old versions in the application rules folder.

    Also maybe worth a try to look at the Windows Event Viewer errors of Rulerunner/DCStudio.

    Regards, Julian



    ------------------------------
    Julian Fiegenbaum | ISR Information Products AG | Consultant | Germany
    ------------------------------



  • 9.  RE: Datacap C# Custom Actions Template not working

    Posted 11 days ago

    Julian, I can't thank you enough for staying with me and helping me work through this issue.  The dcsmart.dll was in the dcshared/NET folder where it belongs and it was the same version as used to compile.  It was not in the application rules folder as desired. I did a search and found that the dcsmart.dll was also in several other locations though.  It was also in all of these locations and it was the same version:

     

    Datacap/Dstudio

    Datacap/dcshared/OCRA/bin

    Datacap/dcshared/OCRJ

    Datacap/dcshared/OCRS

    Datacap/RRS\Box

    Datacap/RRS

     

    I removed it from everywhere except the Datacap/dcshared/NET folder and I can now successfully resolve smart parameters, etc. in the custom action.  I hope I didn't mess any other things up by removing it from those other locations.  It only should belong in the NET folder and nowhere else right?

     

    In any case, I really appreciate your help.  It is greatly appreciated.

     

     

     


    Hi Danny, that sounds like the dcsmart dependency can not be properly resolved at runtime. It should normally be found under .../Datacap... -posted to the "Content Management and Capture" group






  • 10.  RE: Datacap C# Custom Actions Template not working

    Posted 10 days ago

    Hi Danny,

    sometimes you help and sometimes you get help. That's how this community (and life) works :)

    Ok that's weird - those dll locations are normal (don't have a system with OCRJ at hand, but seems reasonable). Afaik your action should still run in a context that draws from dcshared. I can only guess that maybe once one of the other dll was explicitly registered with regasm and now some secondary library cannot be resolved due to path issues? I would to some degree expect the other use cases to be able to use the dll in dcshared. Not sure though.

    I guess you could:



    ------------------------------
    Julian Fiegenbaum | ISR Information Products AG | Consultant | Germany
    ------------------------------