Search

OrderedDictionary becomes Hashtable when exported to and imported from clixml by Roman Kuzmin

Active

2
0
Sign in
to vote
Type: Bug
ID: 771721
Opened: 11/20/2012 5:07:07 AM
Access Restriction: Public
0
Workaround(s)
1
User(s) can reproduce this bug
The following script shows the problem:

    # new OrderedDictionary
    $t1 = [ordered] @{p1=11; p2=22; p3=33}

    # it is OrderedDictionary
    $t1.GetType().Name

    # export
    $t1 | Export-Clixml z1.clixml

    # import
    $t2 = Import-Clixml z1.clixml

    # it is not OrderedDictionary, it is Hashtable
    $t2.GetType().Name

Actual output:

    OrderedDictionary
    Hashtable

Expected output:

    OrderedDictionary
    OrderedDictionary
Details (expand)
How often does this happen?
Always Happens

Have you seen this problem before in this product?

I don't know if this issue existed previously
Reproduction Steps
 
Expected Results
 
File Attachments
0 attachments
Sign in to post a comment.
Posted by Ronald Rink on 1/26/2013 at 7:49 AM
It actually seems that the type information gets lost when importing via Import-CliXml as the exported xml file still contains the following type information: "<T>System.Collections.Specialized.OrderedDictionary</T>".
Sign in to post a workaround.