cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Exception: System.Runtime.InteropServices.COMException: Class not registered

Former Member
0 Likes
2,223

I have been using Powerbuilder 12.5 and I have migrate an old project from classic to .net recently. However there is an error regarding to my openwithparam() statement, each time I run the following code this exception occurred:

{System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Windows.Markup.XamlParseException: 'Initialization of 'AxMSCommLib.AxMSComm' threw an exception.' Line number '40' and line position '14'. ---> System.Runtime.InteropServices.COMException: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))

   at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)   at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)

   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 MS.Internal.Xaml.Runtime.ClrObjectRuntime.InitializationGuard(XamlType xamlType, Object obj, Boolean begin)

   --- End of inner exception stack trace ---

   at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)

   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)

   at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)

   at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)

   at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)

   at System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties)

   at System.Windows.Application.LoadComponent(Uri resourceLocator)

   at Sybase.PowerBuilder.WPF.PBWindow..ctor()

   at c__w_platgi..ctor() in c:\Users\User\Desktop\Phase32.0\offshore.out\offshore5_w_platgi_w.cs:line 0

   --- End of inner exception stack trace ---

   at Sybase.PowerBuilder.PBSessionBase.CreateInstance[T](PBPowerObject parent, Type type, Boolean init, T& t)

   at Sybase.PowerBuilder.PBWindowCreater.CreateWindow[T](Type type, Boolean init, T& t, PBPowerObject p)

   at Sybase.PowerBuilder.PBWindowCreater.CreateWindow[T](Boolean& newWindow, IPBWindow w, Type type, Boolean init, T& t, PBPowerObject p)

   at Sybase.PowerBuilder.PBWindowCreater.CreateWindow[T](Boolean& newWindow, IPBWindow w, Type type, T& t)

   at Sybase.PowerBuilder.WPF.PBSystemFunctions.Open[T0](T0& w)

   at c__gf_winopen.gf_winopen(PBString as_module, PBString as_inspcode, PBAny as_parm) in c:\Users\User\Desktop\Phase32.0\offshore.out\gf_winopen(QSSA):line 26

   at c__w_tree.c__dw_strinsplist.doubleclicked(PBInt xpos, PBInt ypos, PBLong row, PBDWObject dwo) in c:\Users\User\Desktop\Phase32.0\offshore.out\w_tree.dw_strinsplist.doubleclicked:line 52

   at Sybase.PowerBuilder.WPF.PBDataWindow.a(Object A_0, DWClickedEventArgs A_1)}System.Exception {System.Reflection.TargetInvocationException}

Please help me, I am stuck for days.

Accepted Solutions (1)

Accepted Solutions (1)

arnd_schmidt
Active Contributor
0 Likes

'AxMSCommLib.AxMSComm' .. seems to be related to an ActiveX control.


Does the application run without issues in PB12.5 Classic?


Have you allready applied all PowerBuilder Updates etc.?

Former Member
0 Likes

The application runs normally in the pb 12.5 classic and i have updated to pb 12.5.1 but the exception is still there

arnd_schmidt
Active Contributor
0 Likes

Can you locate/isolate the usage of the ActiveX/OCX Control?

Former Member
0 Likes

The more useful information you provide, the more useful the responses.  What type of target did you migrate your classic client/server application code to?  Different targets support different features.  WinForms only partially support in-process ole controls - and there are additional system requirements (e.g., Microsoft ActiveX Control Importer - aximp.exe) .  Presumably you are encountering the error on your development pc and not one on which you have deployed your application - but it would be good to confirm that. 

Former Member
0 Likes

The target is a WPF windows application, I have tried to run on 4 PC and the exception keeps coming up on all the pc. When in the classic application we have used MSComm32 ocx and when we migrate the application to .net the powerbuilder have generated mscommlib as a reference. I hope this info helps.

Former Member
0 Likes

Open up a command window on the development machine and type "aximp" and hit return.  If you don't get a response from the "Microsoft .Net ActiveX Control to Windows Form Assembly Generator", then you don't have the SDK configured correctly.  That utility is used during the Classic to WPF migration to support ActiveX controls.  PB generates a WinForm control wrapper for the ActiveX and then hosts that in WindowsFormsHost control.  That would actually tend to throw a different error, but it's worth verifying.

What the error would indicate that it can't find the ActiveX.  Are you sure it's installed on the machine(s) that you're trying to run the application on?

Finally, what you might also want to consider is simply replacing the functionality that the ActiveX control provided with the equivalent in .Net code. 

Former Member
0 Likes

I have type aximp in the command prompt and there is no response, it seems that the sdk is not configured correctly, how can I fix this?

Former Member
0 Likes

Check to see if aximp is located on the development machine.  It should be located in a Program Files\Microsoft SDKs\Windows\v7.1\bin directory or similar.  This is only needed on the development machine, and only for the initial migration.

Did you see the second question on the installation of the ActiveX?  Are the machines where the code is failing development machines or end-user machines?

Former Member
0 Likes

The aximp is right in place but I am not getteing any response from the aximp command in cmd. The code is failing on on both of the development machine and end user machine

Former Member
0 Likes

Try adding the path to aximp to the system path and then re-performing the migration of the Classic code to .Net.

One more question I haven't seen an answer to:  " Are you sure [the ActiveX] is installed on the machine(s) that you're trying to run the application on?"

Former Member
0 Likes

Looks like that is the solution I needed, I have added aximp to the system path and redo the migration. The exception is no longer there and some of the features like autocad drawings are fixed within the system, thank you!

Former Member
0 Likes

Excellent, good to hear.

Answers (0)