I am experiencing a problem with hidden variables in class-based resource are included in result and trace logs from the Get operation. I think only actual DSC properties should be added to the result and trace log, but these internal variables are actually being included in the result - and in the trace log in a way that make it look like they are DSC properties, which could causes confusion.
I would expect the result and trace log to only output the actual DSC properties as the result from the Get operation.
# The result and trace log includes both the actual DSC properties but also internal properties that are shown as the result from the Get operation.
# Example output from a DebugDscEngine class-based resource wrongly returns the hidden properties localizedData, ExcludeDscProperties and FeatureOptionalEnums.
{
"actualState": {
"KeyProperty": "TEST_KEY_001",
"MandatoryProperty": "CurrentMandatoryStateValue",
"WriteProperty": "CurrentStateValue",
"ReadProperty": "ReadOnlyValue_20250524_084107",
"localizedData": {
"Debug_Modify_Completed": "Modify method completed for KeyProperty '{0}'.",
"KeyProperty_Invalid": "The parameter KeyProperty cannot be null or empty.",
"Debug_Modify_Property": "Modifying property '{0}' to value '{1}'.",
"Getting_CurrentState": "Getting current state for DebugDscEngine resource with KeyProperty '{0}'.",
"TestDesiredState": "Determining the current state for resource '{0}' using the key property '{1}'. (RB0002)",
"Debug_AssertProperties_Completed": "AssertProperties method completed for KeyProperty '{0}'.",
"Debug_GetCurrentState_Returning": "GetCurrentState method returning properties: {0}.",
"Debug_NormalizeProperties_Called": "NormalizeProperties method called for KeyProperty '{0}' with properties: {1}.",
"Debug_AssertProperties_Called": "AssertProperties method called for KeyProperty '{0}' with properties: {1}.",
"SetDesiredState": "Setting the desired state for resource '{0}' using the key property '{1}'. (RB0003)",
"Debug_NormalizeProperties_Completed": "NormalizeProperties method completed for KeyProperty '{0}'.",
"NoPropertiesToSet": "All properties are in desired state. (RB0007)",
"Debug_GetCurrentState_Called": "GetCurrentState method called for KeyProperty '{0}' with properties: {1}.",
"InDesiredState": "The current state is the desired state. (RB0005)",
"NotInDesiredState": "The current state is not the desired state. (RB0004)",
"Debug_NormalizeProperties_Property": "Normalized property '{0}' to value '{1}'.",
"SetProperty": "The property '{0}' will be set to '{1}'. (RB0006)",
"MandatoryProperty_Invalid": "The parameter MandatoryProperty cannot be null or empty.",
"Debug_Modify_Called": "Modify method called for KeyProperty '{0}' with properties to modify: {1}.",
"ModifyMethodNotImplemented": "An override for the method Modify() is not implemented in the resource. (RB0008)",
"GetCurrentState": "Getting the current state for resource '{0}' using the key property '{1}'. (RB0001)",
"GetCurrentStateMethodNotImplemented": "An override for the method GetCurrentState() is not implemented in the resource. (RB0009)"
},
"ExcludeDscProperties": [
"MandatoryProperty"
],
"FeatureOptionalEnums": false
}
}
Prerequisites
Summary
I am experiencing a problem with hidden variables in class-based resource are included in result and trace logs from the Get operation. I think only actual DSC properties should be added to the result and trace log, but these internal variables are actually being included in the result - and in the trace log in a way that make it look like they are DSC properties, which could causes confusion.
The issue #363 track this but it doesn't seem to have been resolved by PR that was expected to resolve it.
Steps to reproduce
dsc --trace-level trace resource get --resource MyModule/MyClassBasedResource --output-format json --input $jsonResourceParametersjsonOutput={"result": ... }and see it has added hidden property to the output.Real-world repro:
jsonOutput={"result": ... }and see it has added hidden property to the output.It's also available here in the issue comment: Add integration test stage for DSCv3 dsccommunity/SqlServerDsc#2102 (comment)
Expected behavior
I would expect the result and trace log to only output the actual DSC properties as the result from the Get operation.Actual behavior
Error details
Not applicableEnvironment data
Version
3.1.0-preview.6
Visuals
No response