Dependson breaks your configuration when using duplicate configurations

Today I ran into the following issue.

I was creating a DSC Configuration with a foreach loop for creating 2 windows clusters with sql installations.
In this configuration I accidentally called the xCluster resource with the same properties twice, and included a DependsOn for the prerequisites.
The MOF Files generated correctly, but when running the config I ran into the following error:

The WS-Management service cannot process the request. The WMI service or the WMI provider returned an unknown error: HRESULT 0x800410
33
+ CategoryInfo : ResourceUnavailable: (root/Microsoft/…gurationManager:String) , CimException
+ FullyQualifiedErrorId : HRESULT 0x80041033
+ PSComputerName : *******

When I started debugging, I quickly found my double entry and this fixed the problem. However I wanted to know where the issue came from.

I noticed that when I did a double config without a Dependson, everything works!

example:

Configuration FileTest
{
    Import-DscResource -Module PSDesiredStateConfiguration
    Node $AllNodes.NodeName
    {
        LocalConfigurationManager
        {
            DebugMode = 'All'
            ActionAfterReboot = 'StopConfiguration'
            ConfigurationMode = 'ApplyOnly'
            RebootNodeIfNeeded = $true
        }
        File File1
        {
            Type = 'Directory'
            DestinationPath = 'C:\Temp'
            Ensure = 'Present'
            Force = $true
        }
        File File2
        {
            Type = 'Directory'
            DestinationPath = 'C:\Temp'
            Ensure = 'Present'
            Force = $true
        }
    }
}

Then I added a secondary resource, and added the DependsOn property for the File resource, that is when the error started again.
example of failing script:

Configuration FileTest
{
    Import-DscResource -Module PSDesiredStateConfiguration
    Import-DscResource -Module xFailoverCluster

    Node $AllNodes.NodeName
    {
        # Set LCM to reboot if needed
        LocalConfigurationManager
        {
            DebugMode = 'All'
            ActionAfterReboot = 'StopConfiguration'
            ConfigurationMode = 'ApplyOnly'
            RebootNodeIfNeeded = $true
        }
        File File1
        {
            Type = 'Directory'
            DestinationPath = 'C:\Temp'
            Ensure = 'Present'
            Force = $true
        }
        xCluster Instance1
        {
            Name = 'Cluster'
            StaticIPAddress = '192.168.10.15'
            DomainAdministratorCredential = $Node.DomainAdministratorCredential
            DependsOn = '[File]File1'
        }
        File File2
        {
            Type = 'Directory'
            DestinationPath = 'C:\Temp'
            Ensure = 'Present'
            Force = $true
        }
        xCluster Instance2
        {
            Name = 'Cluster'
            StaticIPAddress = '192.168.10.15'
            DomainAdministratorCredential = $Node.InstallerServiceAccount
            DependsOn = '[File]File2'
        }
    }
}

It seems that PSDSC does not have problems with double entries, as long as it does not include a dependson. Even though it was a mistake in my configuration to have a ‘double’ entry, it still feels like a bug.

FYI: I tested this on the following powershell versions.
WMF5 - Windows 10 RTM
WMF5 - April Preview 2015
WMF5 - Production Preview

Great tip!