-
Notifications
You must be signed in to change notification settings - Fork 225
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
SqlSetup: Unable to enable debug mode #448
Comments
Oh, it was such a long time since I debugged that way. So it can surely be a bug somewhere making this error. Regarding that you get the same error when removing code in the resource. Did you set the DebugMode in the LCM so it does not cache the resource? What Windows Server and PowerShell version are you running on? Labeling this as a question until we narrow it down to a bug in the resource. |
Yes, the cached setting is set to ForceImportModule and all. We tested on both SQL Server 2016 on Windows Server 2016 and SQL Server 2014 on Windows Server 2012R2 with WMF 5.1. Both failed with same error message. |
I can reproduce this also.
|
Hello has this issue been determined to be a bug in the resource? |
I would recommend to unblock your installation media. Get-Childitem -Path f:\installsource -recurse | unblock-File |
It is possible to debug SqlServerRole, but not SqlSetup. SqlSetup still today throws with the same error as in my last comment. @mgreenegit can you provide any tips on what can cause this? |
@johlju I'm working on this at the moment, so far I worked it to be an issue with either the mof class definition or with parameter definition. Debugging steps completely remove mof class definition parameters, added just the InstanceName and SourcePath to |
@nesith Awesome! I wonder what causes this in the schema - wrong type or a read only parameter, or something else... 🤔 |
@johlju I worked out that the issue is with
specifically $InstanceName is not evaluated as expected. I will let you know when I work out the solution. This issue impacts the SET function as well |
Aha! A solution might be a dynamic parameter, or easier, just assign the value in the code if the parameter is not assigned Looking forward to a PR with the best solution you can find 😄 |
- Changes to SqlSetup - Changed the logic of how default value of FailoverClusterGroupName is set since that was preventing the resource to be able to be debugged (issue #448).
When I tried to enable debug mode for DSC by using:
Enable-DscDebug -BreakAll
Then when I run
Start-DscConfiguration -Path .\SQLServerSetup -Wait -Verbose -Force
Instead of entering breaking mode, it returns error:
Start-DscConfiguration -Path .\SQLServerSetup -Wait -Verbose -Force
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' =
MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer SQL2016 with user sid S-1-5-21-2704606996-4249334842-1457779825-500.
VERBOSE: [SQL2016]: LCM: [ Start Set ]
WARNING: [SQL2016]: [DSCEngine] Warning LCM is in Debug 'ResourceScriptBreakAll' mode. Resource s
cript processing will be stopped to wait for PowerShell script debugger to attach.
VERBOSE: [SQL2016]: [DSCEngine] Importing the module C:\Windows\system32\WindowsPowerShell\v1.0\Mo
dules\xSqlServer\5.0.0.0\DscResources\MSFT_xSQLServerSetup\MSFT_xSQLServerSetup.psm1 in force mode.
VERBOSE: [SQL2016]: [DSCEngine] Importing the module C:\Windows\system32\WindowsPowerShell\v1.0\Mo
dules\xSqlServer\5.0.0.0\DscResources\MSFT_xSQLServerFirewall\MSFT_xSQLServerFirewall.psm1 in force mode.
VERBOSE: [SQL2016]: [DSCEngine] Importing the module C:\Windows\system32\WindowsPowerShell\v1.0\Mo
dules\xSqlServer\5.0.0.0\DscResources\MSFT_xSQLServerMemory\MSFT_xSQLServerMemory.psm1 in force mode.
VERBOSE: [SQL2016]: [DSCEngine] Importing the module C:\Windows\system32\WindowsPowerShell\v1.0\Mo
dules\xSqlServer\5.0.0.0\DscResources\MSFT_xSQLServerConfiguration\MSFT_xSQLServerConfiguration.psm1 in force mode.
VERBOSE: [SQL2016]: [DSCEngine] Importing the module C:\Windows\system32\WindowsPowerShell\v1.0\Mo
dules\xSqlServer\5.0.0.0\DscResources\MSFT_xSQLServerMaxDop\MSFT_xSQLServerMaxDop.psm1 in force mode.
VERBOSE: [SQL2016]: LCM: [ Start Resource ] [[xSQLServerSetup]localhost]
VERBOSE: [SQL2016]: LCM: [ Start Test ] [[xSQLServerSetup]localhost]
VERBOSE: [SQL2016]: [[xSQLServerSetup]localhost] Importing the module MSFT_xSQLServerSetup in forc
e mode.
WARNING: [SQL2016]: [[xSQLServerSetup]localhost] Resource is waiting for PowerShell script debugge
r to attach. Use the following commands to begin debugging this resource script:
Enter-PSSession -ComputerName SQL2016 -Credential
Enter-PSHostProcess -Id 4308 -AppDomainName DscPsPluginWkr_AppDomain
Debug-Runspace -Id 22
VERBOSE: [SQL2016]: LCM: [ End Test ] [[xSQLServerSetup]localhost] in 0.1410 seconds.
PowerShell DSC resource MSFT_xSQLServerSetup failed to execute Test-TargetResource functionality with error message:
Object reference not set to an instance of an object.
+ CategoryInfo : InvalidOperation: (:) [], CimException
+ FullyQualifiedErrorId : ProviderOperationExecutionFailure
+ PSComputerName : localhost
VERBOSE: [SQL2016]: LCM: [ End Set ]
The SendConfigurationApply function did not succeed.
+ CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 1
+ PSComputerName : localhost
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 0.887 seconds
I have tried to setup default values for the parameters and remove ALL logics in Test-TargetResource, it still returns same error.
The text was updated successfully, but these errors were encountered: