cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing GAC assembly with Timer Service

Greg_Pigott
Champ in-the-making
Champ in-the-making

I have a custom assembly that is strongly named and installed in the GAC on both the App server and the Timer Server.

When I run the timer manually through Unity Client, it works correctly.  However, when running through the timer service I get the following error

Unexpected error: Could not load file or assembly 'OnBaseUnityLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5b8815415d9abc8a' or one of its dependencies. The system cannot find the file specified.
at OnBase.Unity.Scripts.TestUnityScript.TestTypeMap(Application app, WorkflowEventArgs args)
at OnBase.Unity.Scripts.TestUnityScript.OnWorkflowScriptExecute(Application app, WorkflowEventArgs args) in c:\Users\gpigott\AppData\Local\Temp\weamvuuh.0.cs:line 43
at Hyland.Core.Unity.ScriptExecutor.WorkflowExecute(Int64 operationId, String sessionId, Int64 workItemContentType, Element contentElement, Element queue, PropertyBag sessionPropertyBag, PropertyBag scopedPropertyBag, Int64 batchDocumentsRemaining, Boolean scriptResult) at Hyland.Core.Workflow.Module.ExecuteUnityScript(Session session, IWorkItemContent item, Int64 batchDocumentsRemaining, Queue queue, UserProperties scopedPropertyBag, Int64 scriptID, Boolean defaultScriptResult)
at Hyland.Core.Workflow.Tasks.Actions.RunUnityScript.ExecutionService.InternalExecute(Session session, IWorkItemContent document, Queue queue, Int64 scriptID, Boolean refresh, AddInExecutionArgs args)
at Hyland.Core.Workflow.Tasks.Actions.RunUnityScript.ExecutionService.ExecuteImpl(Session session, IWorkItemContent content, Queue queue, ITaskConfiguration configuration, ExecutionArgs args)
at Hyland.Core.Workflow.Tasks.ExecutionServiceBase.Execute(Application app, ExecutionArgs args)
at Hyland.Core.Workflow.Action.Execute(Session session, IWorkItemContent document, AddInExecutionArgs executionArgs)

Action: 3325 'Run Test Script'
Type: Sys_RunUnityScript

Any idea on why the GAC assembly cannot be found?

3 REPLIES 3

Brian_Koning
Star Contributor
Star Contributor

Hello Greg,

My first inclination is that the dependency assembly was not installed properly on the Timer Service machine. The reasons for my thoughts are because:

  • The event that handles Unity Script dependency look up is executed after the CLR probes the machine's GAC for the necessary assembly. The Unity Script framework cannot prevent the look up of a GAC assembly, even if there is an unhandled exception in our custom dependency resolution process. This suggests there must be something wrong with the GAC probe itself.
  • The Unity Script you are running is an IWorkflowScript which means it is run by the Core (as opposed to an IClientWorkflowScript which is run by the Unity Client). The same exact Core code executes on the Application Server as in the Workflow Timer Service. I would expect the execution in both environments to fail in a similar fashion if the Unity Script framework was causing issues with loading the dependency.

First, I suggest you attempt to reinstall your custom assembly to your Timer Service machine and see if the problem resolves. If it does not, my next suggestion would be to use the .NET Fusion Log Viewer to have the .NET framework tell you why the assembly binding does not occur. You can find more information on the Fusion Log Viewer on the MSDN here (or search for information on the fuslogvw.exe application). Finally, you may also be able to use Process Monitor to track the failed probe for your assembly and see if there are any related permissions problems.

If you are still having problems after that, I would suggest you contact your first line of API Support for assistance in further troubleshooting.

Greg_Pigott
Champ in-the-making
Champ in-the-making

Thanks for the timely response, Brian!

This pointed me in the right direction and found the failed reference.

Brian_Koning
Star Contributor
Star Contributor

Sure thing, Greg! Happy to help.