php.net |  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
Votes:4
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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: Sekai dot yu at gmail dot com
New email:
PHP Version: OS:

 

 [2009-03-05 09:23 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-06-25 15:04 UTC] cmb@php.net
-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] cmb@php.net
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>
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Oct 26 02:01:23 2020 UTC