Description
Hi,
This could just be me not understanding something important about what's going on under the pwsh hood. If so, sorry.
I'm attempting to export and import some state to file. Getting a serialization error, which seems to indicate the export / importing is not working as described.
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/export-clixml?view=powershell-7
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/import-clixml?view=powershell-7
object [System.Data.DataTable] exported and imported with Export-Clixml and Import-Clixml resulting in differing objects
$DataTableOriginal
col1 : test
RowError :
RowState : Added
Table : {System.Data.DataRow}
ItemArray : {test}
HasErrors : False
$DataTableImported
col1 : test
Steps to reproduce
$DataTableOriginal = [System.Data.DataTable]::new()
$DataTableOriginal.Columns.Add('col1', [string]) | Out-Null
$row = $DataTableOriginal.NewRow()
$row.col1 = 'test'
$DataTableOriginal.Rows.Add($row)
$DataTableOriginal | Export-Clixml -LiteralPath "C:\temp\delete\ExportImport_DataTable\state1.xml"
$DataTableImported = Import-Clixml -LiteralPath "C:\temp\delete\ExportImport_DataTable\state1.xml"
# errors with: Method invocation failed because [Deserialized.System.Data.DataRow] does not contain a method named 'NewRow'
$RowNew = $DataTableImported.NewRow()
Expected behavior
would expected the methods to carry over between export and imports
Actual behavior
Method invocation failed because [Deserialized.System.Data.DataRow] does not contain a method named 'NewRow'
Environment data
Name Value
PSVersion 7.1.0-preview.1
PSEdition Core
GitCommitId 7.1.0-preview.1
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0