Application.RegisterXLL fails with COM Exception 0x800AC472

379 views
Skip to first unread message

Cute Little Devils

unread,
Apr 26, 2021, 9:54:08 AM4/26/21
to Excel-DNA
Hi,

We have a .NET application which uses Excel DNA for calculations and HMI. This application tries to register couple of Excel AddIns when the program starts. It works fine with Win10 - Excel 2016 combination. We have a requirement to support Windows 2019 server - Excel 2016 now. While validating our product on 2019 server, the registration of XLL fails with the following COM exception.

System.Runtime.InteropServices.COMException (0x800AC472): Exception from HRESULT: 0x800AC472
   at Microsoft.Office.Interop.Excel.ApplicationClass.RegisterXLL(String Filename)
   at EmbeddedExcel.ExcelApplicationExtensions.InvokeRegisterXll(Application excelApplication, String fileName)

I tried to register these XLLs using a sample program on the same PC and it registers the XLL successfully. I could not understand

1. What has changed from Windows 10 to Windows 2019 that could break these Xlls from registering. Please note that it's same Excel version, 2016( version 16.0.4266.1001) 32 bit, on both these machines.
2. Why it succeeds with the sample program and fails with our .NET application.

I appreciate any help in resolving this issue ASAP.

Thanks,
Rajaiah.

Govert van Drimmelen

unread,
Apr 27, 2021, 2:26:51 AM4/27/21
to exce...@googlegroups.com
  1. There might be security settings or machine policy that has different defaults under Windows 10 vs Windows Server 2019, though these are often poorly documented and so can be hard to track down.

 

  1. It’s not clear from your description what the “sample program” is that works successfully in the Windows Server 2019 case.

Could you say how the “sample program” and your program differ?

 

-Govert

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/bec33a31-d575-43d7-a65b-dd852697c59cn%40googlegroups.com.

Cute Little Devils

unread,
Apr 27, 2021, 2:53:18 AM4/27/21
to Excel-DNA
Hi Govert,

Thanks for your prompt reply.

Following is my sample program, just a console application, where I am trying to register the skidflow.xll. The call to excelApplication.RegisterXLL returns True with this program, where as our .NET application, which is Winforms based, throws COM Exception, Exception from HRESULT: 0x800AC472. 
I ran both the programs in the same machine. Sample works but the application fails.

Sample program:
 static void Main(string[] args)
        {
            string addInPath = null;

            if (args != null)
                addInPath = args[0];

            var excelApplication = new Microsoft.Office.Interop.Excel.Application();

            if(string.IsNullOrEmpty(addInPath))
                 addInPath = "C:\\Program Files (x86)\\Elster\\ISSplus\\SkidFlow.xll";
            try
            {
                Console.WriteLine("The add in path is :" + addInPath);

                bool result = excelApplication.RegisterXLL(addInPath);
                Console.WriteLine("The result of registerxll is :" + result.ToString());
                Console.ReadLine();
            }
            catch (COMException ex)
            {
                Console.WriteLine("Com exception occurred" + ex.Message);
            }
            catch (TargetInvocationException targetInvocationException)
            {
                Console.WriteLine("Com exception occurred" + targetInvocationException.Message);
            }
        }
    }

Code snippet from our applicaiton:
try
{
using (new ComCallMessageFilter())
{
                        result = excelApplication.RegisterXLL(fileName);
}
callSucceeded = true;
break;
 }
catch (COMException ex)
{
                    Logger.WriteDebug("COM exception occurred InvokeRegisterXll()");

                    Logger.WriteException(ex);
                    
                    Thread.Sleep(10);
}

Please let me know if you need more details.

Thanks,
Rajaiah.

Govert van Drimmelen

unread,
Apr 27, 2021, 2:59:58 AM4/27/21
to exce...@googlegroups.com

Next I suggest you try a simple WinForms application, to see if the difference between the working and failing case is whether it is a Console application or a WinForms application

Cute Little Devils

unread,
Apr 27, 2021, 3:27:02 AM4/27/21
to Excel-DNA
Dear Govert,

I checked with simple Winforms application. The XLL gets registered successfully with it as well.
Please see the attached screen capture.

Thanks,
Rajaiah.
XLLRegisterSuccess.png

Govert van Drimmelen

unread,
Apr 27, 2021, 4:17:09 AM4/27/21
to exce...@googlegroups.com

I’m not sure what ComCallMessageFilter is doing for you in this case.

Maybe you can test without that.

Also make sure that the path the the xll is the same in both cases.

 

Otherwise you will just have to get the working and not-working cases closer together until you see the exact difference that makes it fail.

It might be helpful to others if you post back what you discover.

Cute Little Devils

unread,
May 11, 2021, 6:46:05 AM5/11/21
to Excel-DNA
Hi Govert,

The issue is resolved for us.
Actually the issue was with the activation of the Excel.
We didn't activate the Excel after installing it. When we launch our .net application, it invokes Excel and when the excel is launched, the activation pop up gets displayed and it is hidden behind our application. After activating the Excel, it started working fine.

Thanks a lot for your support.

Regards,
Rajaiah.

Reply all
Reply to author
Forward
0 new messages