Doc #29800 [Ver->Csd]: new DOTNET fails for assemblys other than mscorlib

From: Date: Mon, 21 Oct 2019 07:43:36 +0000
Subject: Doc #29800 [Ver->Csd]: new DOTNET fails for assemblys other than mscorlib
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17031@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=29800&edit=1 ID: 29800 Updated by: cmb@php.net Reported by: christian at wenz dot org Summary: new DOTNET fails for assemblys other than mscorlib -Status: Verified +Status: Closed Type: Documentation Problem Package: COM related Operating System: WinXP PHP Version: 5.0.1 Assigned To: cmb Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2019-10-21 07:43:10] cmb@php.net Automatic comment from SVN on behalf of cmb Revision: http://svn.php.net/viewvc/?view=revision&revision=348193 Log: Fix #29800: new DOTNET fails for assemblys other than mscorlib ------------------------------------------------------------------------ [2019-10-21 07:34:53] cmb@php.net Indeed it is like kevin dot kenny said: .NET classes have to be visible to COM. Changing to documentation issue. ------------------------------------------------------------------------ [2013-10-21 01:28:04] kevin dot kenny at zygonia dot net I think the problem here is that you can only instantiate .NET classes where they're decorated with the ComVisible(true) attribute. For example in the documentation sample code here: http://www.php.net/manual/en/class.dotnet.php The System.Collections.Stack class is decorated with this attribute: http://msdn.microsoft.com/en-us/library/system.collections.stack.aspx As is the System.Windows.Forms.Form class example earlier in this bug report. However if one tries to instantiate a .NET class without this attribute such as System.Xml.XmlDocument: http://msdn.microsoft.com/en-us/library/system.xml.xmldocument Then an exception is thrown: $xml = new DOTNET('System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', 'System.Xml.XmlDocument'); Produces: PHP Fatal error: Uncaught exception 'com_exception' with message 'Failed to instantiate .Net object [Unwrapped, QI for IDispatch] [0x80004002] No such interface supported These are my findings from working with .NET 2.0. There seems to be additional problems with instantiating .NET 4 classes because of changes in the way the GAC is used (or not). ------------------------------------------------------------------------ [2012-01-30 11:10:17] bszabolcs at gmail dot com Strange... the first works, the second gives that exception: $fm = new DOTNET('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', 'System.Windows.Forms.Form'); $sp = new DOTNET('System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', 'System.IO.Ports.SerialPort'); Both are with fully qualifie assembly name... Is there any way to activate more detailed debugging informations to see what is happening in background? ------------------------------------------------------------------------ [2012-01-30 11:05:08] aharvey@php.net Reopening per the last two comments, although I suspect this is firmly in the "patches welcome" category. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=29800 -- Edit this bug report at https://bugs.php.net/bug.php?id=29800&edit=1

« previous php.doc.bugs (#17031) next »