Doc #47569 [Ver->Csd]: DOTNET cannot instantiate generic classes

[email protected] Thu, 02 Dec 2021 18:17:23 +0000
Newsgroups php.doc.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=47569&edit=1

 ID:                 47569
 Updated by:         [email protected]
 Reported by:        Sekai dot yu at gmail dot com
 Summary:            DOTNET cannot instantiate generic classes
-Status:             Verified
+Status:             Closed
 Type:               Documentation Problem
 Package:            COM related
 Operating System:   Windows Server
 PHP Version:        5.2.9
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of cmb69
Revision: https://github.com/php/doc-en/commit/6bc82c07c29f49ad200bd5e40e8da3eb89e54337
Log: Fix #47569: DOTNET cannot instantiate generic classes


Previous Comments:
------------------------------------------------------------------------
[2020-06-25 15:04:33] [email protected]

You can't instantiate System.Console, because that is a static
class, and that limitation is already documented[1].

You can't instantiate System.Collections.Generic.List, because
that is a generic class; that limitation has to be documented.

[1] <https://www.php.net/dotnet>

------------------------------------------------------------------------
[2009-03-05 09:23:00] Sekai dot yu at gmail dot com

Description:
------------
When i've tried to use DOTNET lib's i got an Excpetion errors in 90% of my classes

Tried: System.Console, System.Windows.Forms.MessageBox, System.Collection.Generic.List, System.Windows.Drawing.Graphics (and moch more...)

Reproduce code:
---------------
<?php
/*
$console = new DOTNET("mscorlib", "System.Console");
$var = $console->ReadLine();
$console->WriteLine( "Hello world from PHP - " . $var );

unset( $var );
unset( $console );
exit();
*/
$list = new DOTNET("mscorlib", "System.Collections.Generic.List");

print $list->ToString();
?> 

Expected result:
----------------
Veiwing the Console Commander like in Console APP In c# or use the list generic, grafics etc...

Actual result:
--------------
Fatal error: Uncaught exception 'com_exception' with message 'Failed to instantiate .Net object [CreateInstance] [0x80131522] ' in C:\wamp\www\folder\index.php:2 Stack trace: #0 C:\wamp\www\folder\index.php(2): dotnet->dotnet('mscorlib', 'System.Collecti...') #1 {main} thrown in C:\wamp\www\folder\index.php on line 2



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



--
Edit this bug report at https://bugs.php.net/bug.php?id=47569&edit=1