You are viewing limited content. For full access, please sign in.

Question

Question

SDK Scrip The type initializer for 'Module' threw an exception.

asked on October 25, 2017

I have an SDK Script activity that when run is intermittently throwing the error "The type initializer for 'Module' threw an exception."

The Script will work for a while and then just stop working (the above message is logged in the Workflow messages) and then a bit later start working again for no reason I can work out.  But for the period while it is erroring, my workflows log the error and move on to the next step.

Any idea on what would cause this and/or how to fix it?

0 0

Replies

replied on October 25, 2017

Could you track down the full stack trace in activity errors.log (WF Admin Console\Monitoring\Error Logs)?

0 0
replied on October 25, 2017

Here is an what is in the error log:

----------------------------------------
Timestamp: 2017-10-25 23:58:32.078
Local Time: 10/25/2017 6:58:32 PM
Category: Activity
Machine: XXXXXXXXXXXXXXXX
Severity: Error
Application Domain: Laserfiche.Workflow.Service.exe
Process Id: 4420
Process Name: C:\Program Files\Laserfiche\Laserfiche Workflow 10.2\Laserfiche.Workflow.Service.exe
Win32 Thread Id: 2596 - Task Work Thread [CustomTasks]
Thread Name: Task Work Thread [CustomTasks]
Message: <Exception handlingInstanceId="00d92bf2-704b-48bd-b9c4-b81928f918bc">
  <Description>An exception of type 'Laserfiche.WrappedException' occurred and was caught.</Description>
  <DateTime>2017-10-25 18:58:32Z</DateTime>
  <ExceptionType>Laserfiche.WrappedException, Laserfiche.Base, Version=9.0.0.0, Culture=neutral, PublicKeyToken=607dd73ee2bd1c00</ExceptionType>
  <Message>The type initializer for '&lt;Module&gt;' threw an exception.</Message>
  <Source />
  <HelpLink />
  <Property name="WrappedExceptionType">System.TypeInitializationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</Property>
  <Property name="ActivityName">SDKScript</Property>
  <Property name="TargetSite">&lt;undefined value&gt;</Property>
  <Property name="HResult">-2146233088</Property>
  <StackTrace>   at WorkflowActivity.Scripting.SDKScript.Script1.ImportDoc(String sWinFilePath, Int32 iDocID, Int32&amp; iPageNum)
   at WorkflowActivity.Scripting.SDKScript.Script1.Execute()
   at WorkflowActivity.Scripting.ScriptBase.ExecuteScript(ScriptExecutionContext context)</StackTrace>
  <additionalInfo>
    <info name="MachineName" value="XXXXXXXXXXXXXXXX" />
    <info name="TimeStamp" value="10/25/2017 11:58:32 PM" />
    <info name="FullName" value="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <info name="AppDomainName" value="Laserfiche.Workflow.Service.exe" />
    <info name="ThreadIdentity" value="" />
    <info name="WindowsIdentity" value="NT AUTHORITY\SYSTEM" />
  </additionalInfo>
  <InnerException>
    <ExceptionType>Laserfiche.WrappedException, Laserfiche.Base, Version=9.0.0.0, Culture=neutral, PublicKeyToken=607dd73ee2bd1c00</ExceptionType>
    <Message>The C++ module failed to load during appdomain initialization.
</Message>
    <Source />
    <HelpLink />
    <Property name="WrappedExceptionType">&lt;CrtImplementationDetails&gt;.ModuleLoadException, PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35</Property>
    <Property name="TargetSite">&lt;undefined value&gt;</Property>
    <Property name="HResult">-2146233088</Property>
    <StackTrace>   at &lt;CrtImplementationDetails&gt;.ThrowModuleLoadException(String errorMessage, Exception innerException)
   at &lt;CrtImplementationDetails&gt;.LanguageSupport.Initialize(LanguageSupport* )
   at .cctor()</StackTrace>
    <InnerException>
      <ExceptionType>Laserfiche.WrappedException, Laserfiche.Base, Version=9.0.0.0, Culture=neutral, PublicKeyToken=607dd73ee2bd1c00</ExceptionType>
      <Message>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\WPF\wpfgfx_v0400.dll</Message>
      <Source />
      <HelpLink />
      <Property name="WrappedExceptionType">System.DllNotFoundException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</Property>
      <Property name="TargetSite">&lt;undefined value&gt;</Property>
      <Property name="HResult">-2146233088</Property>
      <StackTrace>   at MS.Internal.NativeWPFDLLLoader.LoadNativeWPFDLL(UInt16* relDllPath, UInt16* baseDllPath)
   at MS.Internal.NativeWPFDLLLoader.LoadCommonDLLsAndDwrite()
   at ?A0xc56dd114.CreateCModuleInitialize()
   at ?A0xc56dd114.??__E?A0xc56dd114@cmiStartupRunner@@YMXXZ()
   at _initterm_m((fnptr)* pfbegin, (fnptr)* pfend)
   at &lt;CrtImplementationDetails&gt;.LanguageSupport.InitializePerAppDomain(LanguageSupport* )
   at &lt;CrtImplementationDetails&gt;.LanguageSupport.Initialize(LanguageSupport* )</StackTrace>
      <InnerException>
        <ExceptionType>Laserfiche.WrappedException, Laserfiche.Base, Version=9.0.0.0, Culture=neutral, PublicKeyToken=607dd73ee2bd1c00</ExceptionType>
        <Message>The specified procedure could not be found</Message>
        <Source />
        <HelpLink />
        <Property name="WrappedExceptionType">System.ComponentModel.Win32Exception, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</Property>
        <Property name="TargetSite">&lt;undefined value&gt;</Property>
        <Property name="HResult">-2146233088</Property>
        <StackTrace />
      </InnerException>
    </InnerException>
  </InnerException>
</Exception>
----------------------------------------

 

0 0
replied on October 26, 2017

Do you have .Net 4.7 installed? What does this script do?

0 0
replied on October 26, 2017

Yes .Net 4.7 is installed.

The script imports images into Laserfiche documents.

0 0
replied on October 26, 2017

That means you have a reference to Laserfiche.DocumentServices in the script, right?

Do you have Microsoft Visual C++ 2017 Redistributable installed?

What is the OS?

0 0
replied on October 26, 2017

Relatedly, can you check the version of c:\Windows\System32\msvcp140.dll?  Your error is very similar to one we've seen in other situations and we are working with Microsoft to figure it out the root cause.  If you have a way to trigger it even occasionally that would be helpful.

0 0
replied on October 26, 2017 Show version history

Yes I do reference Laserfiche.DocumentServices

No Microsoft Visual C++ 2017 Redistributable is not installed.

    The installed VC+ Redistributables are:

        2005 (x64)

        2008 (x64) (9.0.30729.4148)

        2008 (x86) (9.0.30729.4148)

        2008 (x64) (9.0.30729.6161)

        2008 (x86) (9.0.30729.6161)

        2010 (x64)

        2010 (x86)

        2012 (x64)

        2012 (x86)

        2013 (x64)

        2013 (x86)

        2015 (x64)

        2015 (x86)

OS is Server 2008 R2 SP1

mscpl140.dll v14.0.23918.0

The problem has come and gone before with no changes in the script and right now I have the problem and can not get it to go away. 

0 0
replied on October 26, 2017

Is it up-to-date on Windows updates? Can you check if this Windows update is installed? (I would've expected you'd run into it installing .Net 4.7, but maybe newer updates broke it again)

Background info: we've had an issue in the summer where .Net 4.7 was missing a file. We ran into it on Windows 2016 Core where .Net 4.7 was pushed through Windows updates. The missing file was a dependency of the WPF.dll which we load in some cases for image processing. The behavior was exactly what you're seeing. We haven't seen the issue in any versions of Windows with the UI installed because the UI was installing the missing file. On OSs older than Windows 2016, the behavior was that .Net 4.7 was blocked from installing.

 

0 0
replied on October 27, 2017

Yes, KB 4019990 is installed.  It does not have a repair option (only uninstall is available), and if I run the installer, then it returns a message that the update is already installed and ends.

Is there a reliable workaround at this point? This workflow is part of a conversion process from another system into Laserfiche and missing documents or pages is not at all good.

0 0
replied on October 27, 2017

Not really, because they're Windows libraries. Can we take this offline through Tech Support though so we can do more digging? We might have to open a case with Microsoft.

Please attach the script, a couple of the images that failed, Workflow's Logs folder and the Windows event logs.

0 0
replied on October 27, 2017

If we move the workflow to a machine without .Net 4.7 will that get around the issue?

0 0
replied on October 27, 2017

It should, yes. If you don't mind though, we'd still like to investigate this one.

0 0
replied on October 27, 2017

When creating a support case, please reference this Answers thread.

0 0
replied on October 27, 2017

If you email me bwarren@opg-3.com and let me know what you want, I will try to get it for you, but this is part of a conversion that must keep moving forward.

0 0
replied on March 21, 2019

Hi Bert,

How'd you go with this. I've had these errors intermittently before as well.

-Ben

0 0
replied on March 21, 2019

This was a conversion so the customer had set up a temp VM to run the conversion workflows (didn't want to bottleneck production workflows).  To work around the issue, the customer gave us a different VM without .Net 4.7 installed to run the conversion WFs from.

1 0
replied on March 21, 2019

Thanks

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.