microsoft / microsoft/powerbi-powershell

Unable to use cmdlets in Visual Studio Code - Possible Newtonsoft version mismatch

Open
#202 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
413
Forks
134
Avg merge
33m
Merged PRs (30d)
1

Description

System Details

System Details Output

### VSCode version: 1.41.1 26076a4de974ead31f97692a0d32f90d735645c0 x64

### VSCode extensions:
ms-vscode.powershell@2019.12.0


### PSES version:

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      5.1.14393.3383
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.3383
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

I am experiencing a problem with running cmdlets from MicrosoftPowerBIMgmt module. Same script works as expected in ISE but fails in Visual Studio Code.
I was not sure whether to log this here or in the Extension repo - so I put the information in both places

I am unable to run Get-PowerBIActivityEvent
I believe the issue could be caused by version of the Newtonsoft.Json.dll that came with December version of the Powershell extension - it is 11.0.0 while the module requires 12.0.2 and higher.

`PS C:\Windows\system32> [Newtonsoft.Json.JsonConvert].Module

MDStreamVersion : 131072
FullyQualifiedName : C:\Users****.vscode\extensions\ms-vscode.powershell-2019.12.0\modules\PowerShellEditorServices\bin\Desktop\Newtonsoft.Json.dll
ModuleVersionId : 07e38931-19a9-45b2-9a35-e81930b1c8ad
MetadataToken : 1
ScopeName : Newtonsoft.Json.dll
Name : Newtonsoft.Json.dll
Assembly : Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
CustomAttributes : {}
ModuleHandle : System.ModuleHandle`

Expected Behaviour

execution of the same cmdlet in ISE returns results as expected with no errors.

Actual Behaviour

I get the following error:

`Get-PowerBIActivityEvent : Attempted to access an element as a type incompatible with the array.

    + CategoryInfo          : WriteError: (Microsoft.Power...BIActivityEvent:GetPowerBIActivityEvent) [Get-PowerBIActivityEvent], ArrayTypeMismatchException
    + FullyQualifiedErrorId : Attempted to access an element as a type incompatible with the array.,Microsoft.PowerBI.Commands.Admin.GetPowerBIActivityEvent`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docs/troubleshooting.md and reproduce Get-PowerBIActivityEvent in Visual Studio Code and ISE using the reported PowerShell and extension versions. Inspect the loaded Newtonsoft.Json assembly and compare the two environments; done means the cmdlet runs successfully in Visual Studio Code without the ArrayTypeMismatchException.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, vscode
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.