-
Notifications
You must be signed in to change notification settings - Fork 65
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
New-CrmEntityReference throws error in latest module versions #489
Comments
Thanks for reaching out - after doing performance testing we made these changes as it helped improve performance by a good margin (especially for folks working with moderately large sized record sets). Can you try this to see if it works in PowerShell 4.0?
|
Thanks for the response.
As a side note, I tried tab completion on the term
I also browsed through the PowerShell documentation available on docs.microsoft.com, and it seems that formal support for classes and the |
That will definitely be an issue, unfortunately. I can go back to try the comparison again to see how much of a performance increase there is to see if it's worth going back to new-object or not? |
No I don't think that's necessary, thank you. We can get by using the older module version - the main thing is that we got our integrations working again. Just wanted you to know about our issue. Also, we'll probably look shortly into either installing Management Framework 5 on the server, or upgrading the entire server since 2012R2 is nearing it's EOL (Oct 2023). However, if I may suggest, if you still intend to support PowerShell v4 as a platform for the module, would it be possible to implement alternative execution paths where required? I mean, for example, use the old statement |
I really appreciate you sharing this detail, I'm wondering if it might make sense to update our manifest to support v5 since we now have v5 specific features we're now using, also I know many platforms that run WMF v4 are going end of life (not quite yet, but soon). |
On Windows Server 2012 R2 with PowerShell 4.0 we had to downgrade the module from v2.8.14 to v2.8.11 because we started receiving the following error when fetching CRM data:
System.Management.Automation.RuntimeException: Method invocation failed because [Microsoft.Xrm.Sdk.EntityReference] does not contain a method named 'new'.
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction
2.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.PSScriptCmdlet.RunClause(Action
1 clause, Object dollarUnderbar, Object inputToProcess)at System.Management.Automation.PSScriptCmdlet.DoEndProcessing()
at System.Management.Automation.CommandProcessorBase.Complete()
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-CrmRecordsByFetch
+ PSComputerName : localhost
OperationStopped: (:String) [], RuntimeException
+ CategoryInfo : OperationStopped: (:String) [], RuntimeException
+ FullyQualifiedErrorId :
+ PSComputerName : localhost
We traced the issue to the implementation of the New-CrmEntityReference cmdlet, where the previous method of creating a new EntityReference
$crmEntityReference = New-Object -TypeName Microsoft.Xrm.Sdk.EntityReference
has been replaced by
$crmEntityReference = [Microsoft.Xrm.Sdk.EntityReference]::new()
We assume this has something to do with the PS version, since on Windows 10 the latest module version works perfectly.
The text was updated successfully, but these errors were encountered: