none
Regarding an abstract class "Microsoft.Windows.Kits.Hardware.ObjectModel.Target" RRS feed

  • Question

  • Hello,

    I've loaded assembly "Microsoft.Windows.Kits.Hardware.ObjectModel.dll" which contains an "ABSTRACT" class "Target".

    I want to create a generic list (System.Collections.Generic.List`1) of type [Microsoft.Windows.Kits.Hardware.ObjectModel.Target] , in powershell as:

    $list=New-Object "System.Collections.Generic.List``1[Microsoft.Windows.Kits.Hardware.ObjectModel.Target]"

    but I'm failing and getting this error:

    Cannot find type [System.Collections.Generic.List``1[Microsoft.Windows.Kits.Hardware.ObjectModel.Target]]: Make sure the assebly containing this type is loaded.

    I have verified that the assembly has been loaded correctly. Also I have verified that this assembly contains the type "Microsoft.Windows.Kits.Hardware.ObjectModel.Target" using $assembly.GetTypes() method. And I have verified that the type "Microsoft.Windows.Kits.Hardware.ObjectModel.Target" is not being resolved.

    So the reason behind this error is the class being Abstract (As we can not instantiate it)? or anything else? What could be the solutions?

    Wednesday, November 7, 2012 11:08 AM

All replies

  • Does the following work in powershell?

    $TestList =New-Object"System.Collections.Generic.List``1[System.string]"

     Also a common error is using the apostrophe after the List statement.  Note that it's an accent character ` and not an apostrophe ' after  Generic.List.  I get the exact same error if I use the apostrophe character instead.


    This posting is provided "AS IS" with no warranties, and confers no rights

    Tuesday, November 13, 2012 6:27 AM
  • Does the following work in powershell?

    $TestList =New-Object"System.Collections.Generic.List``1[System.string]"

     Also a common error is using the apostrophe after the List statement.  Note that it's an accent character ` and not an apostrophe ' after  Generic.List.  I get the exact same error if I use the apostrophe character instead.


    This posting is provided "AS IS" with no warranties, and confers no rights

    Not sure why this was marked as an answer but it isn't one. I am still having the exact problem as everyone above and I am definitely using the right accent character and I CAN create a basic System.string list. 
    Monday, November 19, 2012 10:09 PM
  • $TestList=New-Object"System.Collections.Generic.List``1[System.string]"

    works, even this works, $TestList=New-Object"System.Collections.Generic.List``1[System.object]"

    So it is a "Microsoft.Windows.Kits.Hardware.ObjectModel.Target" type which is not being resolved.

    One more thing I would like to ask is, Microsoft.Windows.Kits.Hardware.ObjectModel.Target is an abstract class meaning we can not create its object but we can inherit it, so as we can not have its own object then how can we initiate a list of its type?

    Monday, December 3, 2012 8:04 AM
  • The OM does allow creating direct instances of target objects. Target objects are obtained through calls to create a target (TargetFamily::CreateTarget(...) and ProductInstance::CreateTarget(...)). If you need specific information based on target types, you can use Target.TargetType to help cast a Target as a specific type such as IDeviceTargetData, ISystemTargetData, IFilterTargetData, and IDeviceCOllectionTargetData.


    John -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, December 3, 2012 9:21 PM
  • Updated Powershell to version 3.0

    All issues are resolved.

    I think, Microsoft should specify in the WHCK 2.0 API documentation to update powershell. :)

    Friday, December 7, 2012 7:20 AM