msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

All Invoke-MgGraphRequest commands return error 'format-default: Object reference not set to an instance of an object.'

Open ThoughtContagion opened this issue 1 year ago • 1 comments

Thanks for reporting the bug. Please ensure you've gone through the following checklist before opening an issue:

  • Make sure you can reproduce this issue using the latest released version of Microsoft.Graph or Microsoft.Graph.Beta.
  • Please search the existing issues to see if there has been a similar issue filed.
  • For issues related to authentication and service errors, please refer to our troubleshooting guide. For service issues, please open a question at https://developer.microsoft.com/graph/support.

Describe the bug

  • On PS 7.3.5, Graph and Graph Beta modules version 2.11.1 work as expected.
  • On PS 7.4 Graph and Graph Beta modules version 2.1.0 work as expected
  • On PS 7.4 Graph and Graph Beta modules version 2.11.0 and version 2.11.1 fails on any Invoke-MgGraphRequest command, but corresponding -Mg cmdlets work as expected. This was with and without Set-StrictMode -Off.
  • On PS 5.1 Graph and Graph Beta modules version 2.1.0 - 2.11.1 work as expected.
  • Found a similar issue here that was supposedly fixed in 2.11.1 - https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/2488

To Reproduce Steps to reproduce the behavior:

  1. Execute Invoke-GraphRequest or Invoke-MgGraphRequest with Microsoft.Graph.Beta version 2.11.1 in PowerShell 7.4
  2. See error format-default: Object reference not set to an instance of an object.

Expected behavior

Values of the query returned.

Debug Output

Run the problematic command with -Debug and paste the resulting debug stream below. ⚠ ATTENTION: Be sure to remove any sensitive information that may be in the logs.

Module Version

Please run Get-Module Microsoft.Graph* after cmdlet execution and paste the output below. Microsoft.Graph.Beta 2.11.1

Environment Data

Please run $PSVersionTable and paste the output below. If running the Docker container image, indicate the tag of the image used and the version of Docker engine.

Major  Minor  Patch  PreReleaseLabel BuildLabel
-----  -----  -----  --------------- ----------
7      4      0

ThoughtContagion avatar Jan 03 '24 15:01 ThoughtContagion

This issue will be tracked in https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/1947

timayabi2020 avatar Feb 27 '24 12:02 timayabi2020