Skip to content

PlannerTask: Null-valued expression exception for tasks with assigned category7 and greater #6052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jaebischer opened this issue Apr 25, 2025 · 0 comments · Fixed by #6057 or #6096
Closed

Comments

@jaebischer
Copy link

Description of the issue

If a task has an assigned category greater than category6 the export will fail because the function GetTaskColorNameByCategory returns $null in this case. The exception is thrown in Get-DSCBlock because the array Categories contains $null

A planner task can have up to 25 categories: https://learn.microsoft.com/en-us/graph/api/resources/plannercategorydescriptions?view=graph-rest-1.0

Microsoft 365 DSC Version

1.25.423.1

Which workloads are affected

Planner

The DSC configuration

Verbose logs showing the problem

{InvalidOperation}
System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression.
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at <ScriptBlock>(Closure , FunctionContext )
   at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
   at System.Management.Automation.ScriptBlock.<>c__DisplayClass57_0.<InvokeWithPipe>b__0()
   at System.Management.Automation.Runspaces.RunspaceBase.RunActionIfNoRunningPipelinesWithThreadCheck(Action action)
   at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
   at System.Management.Automation.ScriptBlock.InvokeUsingCmdlet(Cmdlet contextCmdlet, Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Object[] args)
   at Microsoft.PowerShell.Commands.ForEachObjectCommand.ProcessRecord()
   at System.Management.Automation.CommandProcessor.ProcessRecord()
"Error during Export:"
at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\ReverseDSC\2.0.0.28\ReverseDSC.Core.psm1: line 341
at <ScriptBlock>, C:\Program Files\WindowsPowerShell\Modules\ReverseDSC\2.0.0.28\ReverseDSC.Core.psm1: line 320
at Get-DSCBlock, C:\Program Files\WindowsPowerShell\Modules\ReverseDSC\2.0.0.28\ReverseDSC.Core.psm1: line 157
at Get-M365DSCExportContentForResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.423.1\Modules\M365DSCUtil.psm1: line 3658
at Export-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.423.1\DSCResources\MSFT_PlannerTask\MSFT_PlannerTask.psm1: line 792
at Start-M365DSCConfigurationExtract, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.423.1\Modules\M365DSCReverse.psm1: line 682
at Export-M365DSCConfiguration, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.423.1\Modules\M365DSCUtil.psm1: line 1328

Environment Information + PowerShell Version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant