Skip to content

Commit d552c33

Browse files
serialization fix at parameter level
1 parent 13e633c commit d552c33

File tree

5 files changed

+9
-2
lines changed

5 files changed

+9
-2
lines changed
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

PSModuleDevelopment/functions/templating/Invoke-PSMDTemplate.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@
317317
[OutputType([PSModuleDevelopment.Template.TemplateResult])]
318318
[CmdletBinding()]
319319
param (
320+
[PSFramework.Utility.ScriptTransformation('PSModuleDevelopment.TemplateItem', [PSModuleDevelopment.Template.TemplateItemBase])]
320321
[PSModuleDevelopment.Template.TemplateItemBase]
321322
$Item,
322323

PSModuleDevelopment/internal/scripts/initialize.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,10 @@ if (-not (Test-Path (Get-PSFConfigValue -FullName 'PSModuleDevelopment.Debug.Con
1010
#endregion Ensure Config path exists
1111

1212
# Pass on the host UI to the library
13-
[PSModuleDevelopment.Utility.UtilityHost]::RawUI = $host.UI.RawUI
13+
[PSModuleDevelopment.Utility.UtilityHost]::RawUI = $host.UI.RawUI
14+
15+
# Register Type-Conversion to fix template issues in serialization edge-casaes
16+
Register-PSFArgumentTransformationScriptblock -Name 'PSModuleDevelopment.TemplateItem' -Scriptblock {
17+
if ($_ -is [PSModuleDevelopment.Template.TemplateItemBase]) { return $_ }
18+
[PSModuleDevelopment.Template.TemplateHost]::GetTemplateItem($_)
19+
}

library/PSModuleDevelopment/PSModuleDevelopment/Template/TemplateHost.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace PSModuleDevelopment.Template
1212
/// <summary>
1313
/// Static helpers for the template system
1414
/// </summary>
15-
internal static class TemplateHost
15+
public static class TemplateHost
1616
{
1717
internal static TemplateItemBase GetTemplateItem(object Item)
1818
{

0 commit comments

Comments
 (0)