InfoPath Form Control crashes on 64-bit OS - InfoPath Dev
in

InfoPath Dev

InfoPath Form Control crashes on 64-bit OS

Last post 06-18-2009 11:13 AM by TCSCdpr. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-17-2009 05:59 PM

    InfoPath Form Control crashes on 64-bit OS

    We have been using the InfoPath Form Control successfully on Windows XP and Vista 32-bit machines quite a bit.  But when we run the same application on a 64-bit machine, it crashes at the end of the control initialization when the ActiveX control attempts to create the InfoPath instance.

    I downloaded the Microsoft InfoPath Form Control sample application (InfoPath2007UsingIOLECommands_RTM) here: http://www.microsoft.com/downloads/details.aspx?FamilyId=F65C20DF-ADC2-446A-8FBC-D7C5ED5DD83F&displaylang=en.  The Microsoft sample app crashes in exactly the same place with the same error.  But InfoPath itself (the application) runs fine in the same context.

    What's causing the InfoPath Form Control to crash on a 64-bit platform?

    System.Runtime.InteropServices.COMException was unhandled
      Message="Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))"
      Source="System.Windows.Forms"
      ErrorCode=-2147221164
      StackTrace:
           at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
           at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
           at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
           at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
           at System.Windows.Forms.AxHost.CreateInstance()
           at System.Windows.Forms.AxHost.GetOcxCreate()
           at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
           at System.Windows.Forms.AxHost.CreateHandle()
           at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
           at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
           at System.Windows.Forms.AxHost.EndInit()
           at HostedApplication.MainForm.InitializeComponent() in C:\Projects\Infopath2007\InfoPath2007UsingIOLECommands_RTM\HostedApplication\MainForm.designer.cs:line 1440
           at HostedApplication.MainForm..ctor(String[] args) in C:\Projects\Infopath2007\InfoPath2007UsingIOLECommands_RTM\HostedApplication\MainForm.cs:line 64
           at HostedApplication.Program.Main(String[] args) in C:\Projects\Infopath2007\InfoPath2007UsingIOLECommands_RTM\HostedApplication\Program.cs:line 17
           at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException:

  • 06-18-2009 11:13 AM In reply to

    Re: InfoPath Form Control crashes on 64-bit OS

    Problem resolved (or at least avoided).

    A 64-bit OS can create an app domain that runs in EITHER 32-bit OR 64-bit mode.  The two modes can not be mixed in a single app domain.  So when the application that hosts InfoPath is built using the "Any CPU" configuration, a 64-bit OS loads it into a 64-bit app domain.  Microsoft provides only 32-bit Interop assemblies for InfoPath, so the CoCreateInstance fails, since no native 64-bit assembly is registered.

    Therefore, we can wait for Microsoft to provide native X64 interop DLL's (doubtful) or coerce the 64-bit OS to load the host application into a 32-bit app domain.

    Change the build configuration to X86 and rebuild the application.  This forces the OS to load the hosting app into a 32-bit app domain where the 32-bit InfoPath interop DLL's feel right at home.

    Dave

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.