|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #47569 DOTNET cannot instantiate generic classes
Submitted: 2009-03-05 09:23 UTC Modified: 2020-06-25 15:04 UTC
Avg. Score:5.0 ± 0.0
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:2 (50.0%)
From: Sekai dot yu at gmail dot com Assigned:
Status: Verified Package: COM related
PHP Version: 5.2.9 OS: Windows Server
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
19 + 27 = ?
Subscribe to this entry?

 [2009-03-05 09:23 UTC] Sekai dot yu at gmail dot com
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:
$console = new DOTNET("mscorlib", "System.Console");
$var = $console->ReadLine();
$console->WriteLine( "Hello world from PHP - " . $var );

unset( $var );
unset( $console );
$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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-06-25 15:04 UTC]
-Summary: DOTNET Excpection error +Summary: DOTNET cannot instantiate generic classes -Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem
 [2020-06-25 15:04 UTC]
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] <>
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Sep 26 13:03:37 2021 UTC