Bug #29800 [Com]: new DOTNET fails for assemblys other than mscorlib

From: Date: Mon, 30 Jan 2012 11:10:17 +0000
Subject: Bug #29800 [Com]: new DOTNET fails for assemblys other than mscorlib
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-166955@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
 Comment by:         bszabolcs at gmail dot com
 Reported by:        christian at wenz dot org
 Summary:            new DOTNET fails for assemblys other than mscorlib
 Status:             Open
 Type:               Bug
 Package:            COM related
 Operating System:   WinXP
 PHP Version:        5.0.1
 Block user comment: N
 Private report:     N

 New Comment:

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?


Previous Comments:
------------------------------------------------------------------------
[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.

------------------------------------------------------------------------
[2012-01-30 10:48:03] bszabolcs at gmail dot com

This bug is still present in PHP 5.3.8.

Here is the code I tried to use:

$sp = new DOTNET('System, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089', 'System.IO.Ports.SerialPort');

The error message:

Fatal error: Uncaught exception 'com_exception' with message 'Failed to 
instantiate .Net object [Unwrapped, QI for IDispatch] [0x80004002] No such 
interface supported '

------------------------------------------------------------------------
[2008-12-10 19:42:11] vince at siol dot net

Description:
---------------
As far as I can tell this bug is still present in 5.2.6. Using a fully qualified assembly name
reproduces a different error, so it might be a step closer to working. 


Reproduce code:
---------------
$object = new DOTNET(
'System,Version=2.0.0.0,Culture=neutral,PublicKeyToken=B77A5C561934E089',
'System.Diagnostics.Process' );


Expected result:
----------------
- no output --


Actual result:
---------------
PHP Fatal error:  Uncaught exception 'com_exception' with message 'Failed to
instantiate .Net object [Unwrapped, QI for IDispatch] [0x80004002] No such interface supported
'

------------------------------------------------------------------------
[2004-10-17 01:00:04] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------
[2004-10-09 06:45:05] wez@php.net

Hey Christian,

You probably need to fully qualify the assembly name to get it working.

Here's a non-working example; the assembly is loaded but object unwrapping doesn't give us
an IDispatch'able handle, so instantiation fails.

Don't ask me how you determine the version and key tokens; I pulled these out of a decompiled
.tlb file :-/

$f = new
DOTNET('System.Windows.Forms,Version=1.0.5000.0,Culture=neutral,PublicKeyToken=b77a5c561934e089',
'System.Windows.Forms.Form');

PS: the next HEAD snapshot will contain better startup and error reporting for these things;
possibly fixing that other  .net bug you reported a little while back.


------------------------------------------------------------------------


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


Thread (9 messages)

« previous php.bugs (#166955) next »