0

I am building a Linux docker image for a .net core application. Target framework: .Net Core 2.2. The docker file was built successfully. I got following error when I run the container.

Unhandled Exception: System.PlatformNotSupportedException: COM is not supported

I suspect this error is related to a third-party COM control used by this application. But I don't know why this error still occurs even the image was successfully built?

wltz
  • 621
  • 1
  • 11
  • 22

1 Answers1

0

Even you know, COM technology is not supported in .NET Core.
There may be API calls on COM in something package you incorporated.

If you recorded logs and traces, have any information left in it?
If you examine the records before and after the problem occurred, you may notice something.

Alternatively, check with the tool shown below.
However, I do not use these tools myself, so please ask the appropriate place for details.

Analyze your dependencies to port code to .NET Core
.NET API analyzer
The .NET Portability Analyzer
The .NET Framework Analyzer


Currently there seems to be no COM Interop support in .NET Core or .NET Standard.
It does not seem to be in the future either.

Clarify direction of COM Interop #55
Can you make a .NET Standard assembly COM-Visible? #412
.NET Core 2.1 - How to create COM object and generate *.tlb file
Com Interop in .netcore #8654
Does .Net Core support the creation of COM objects? #31359

kunif
  • 4,060
  • 2
  • 10
  • 30
  • Thansk for the response. I did used Analyze Assembly Portability tool to analyze the whole solution. Result is 100 with .NET Core + Platform Extension. I am wondering that if I could register the COM dll in the dockerfile. – wltz Jan 11 '19 at 16:33
  • Perhaps, this mechanism may be used. [Registration-Free COM Interop](https://learn.microsoft.com/en-us/dotnet/framework/interop/registration-free-com-interop) However, first of all it would be better to specify where the exception occurred. – kunif Jan 11 '19 at 17:31
  • Thanks for the update. It might be possible to use COM control in .Net Core 2.0 with limitation. [link](http://joelleach.net/2018/06/06/com-interop-with-net-core-2-0/) I don't if there are work around for linux container. – wltz Jan 14 '19 at 03:24