|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-08-23 17:46 UTC] christian at wenz dot org
Description:
------------
The .NET sample from the manual (stack, Pop(), Push()) works fine with the new patch, however I encounter problems instanciating .NET objects that are _not_ in mscorlib. I don't think there is an error in my code.
Reproduce code:
---------------
<?php
$dotnetxsl = new DOTNET("System.Xml", "System.Xml.Xsl.XslTransform");
?>
Expected result:
----------------
no output
Actual result:
--------------
Fatal error: Uncaught exception 'com_exception' with message 'Failed to instantiate .Net object' in e:\Inetpub\wwwroot\php\dotnet1.php:2 Stack trace: #0 {main} thrown in e:\Inetpub\wwwroot\php\dotnet1.php on line 2
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 20:00:02 2025 UTC |
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.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 '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?