azure-ad-b2c / vscode-extension

Azure AD B2C VS code extension
MIT License
64 stars 37 forks source link

Build recursively populating Environments folder until crash #37

Closed trittimo closed 3 years ago

trittimo commented 3 years ago

Extension version: 1.2.101 Description of bug: Build is recursively populating the Environments folder until VS Code crashes. image

It appears that this only happens if you build when there is a pre-existing Environments folder there.

I downgraded to 1.2.93 and things work normally again. Haven't tried all the versions in between.

Reproduction steps:

  1. Create a new folder
  2. Create TrustFrameworkBase.xml. I just copied from one of my projects, I don't believe the content matters (although I haven't experimented here)
  3. Create a new appsettings.json w/ the following content:
    {
    "Environments": [
        {
            "Name": "Sandbox",
            "Production": false,
            "Tenant": "yourtenant.onmicrosoft.com",
            "PolicySettings" : {
                "PolicySuffix": ""
            }
        },
        {
            "Name": "Testing",
            "Production": false,
            "Tenant": "yourtenant.onmicrosoft.com",
            "PolicySettings" : {
                "PolicySuffix": ""
            }
        }
    ]
    }
  4. Build
  5. Build again
  6. See that you now have a recursive tree
Norrch2 commented 3 years ago

Hi Trittimo, I am unable to duplicate this. Are you able to provide reproduction steps?

trittimo commented 3 years ago

Hey @Norrch2, I have updated my original comment w/ repro steps. Can you give it a try and see if the same happens for you?

Norrch2 commented 3 years ago

Hi Trittimo, do you happen to have any settings for workspaces being used?

trittimo commented 3 years ago

Hi Trittimo, do you happen to have any settings for workspaces being used?

These are my global extension settings: image

I don't have a .vscode/settings.json file in the folder

I confirmed w/ two colleagues that we are seeing the same thing after updating.

trittimo commented 3 years ago

@Norrch2 Seems problematic: https://github.com/azure-ad-b2c/vscode-extension/commit/3521ffa239cad2867e4708fc0dc1f43f00207bf7#diff-f043ea87d80b57405b1443de20e80ae8606707e53499da68f694907e7d8806e7R45

trittimo commented 3 years ago

@Norrch2 Figured it out. Adding a new variable EnvironmentsFolder to the appsettings fixed it. I guess that's a new variable? There probably needs to be a check to see if the value has been set in the appsettings.json and either throw an error or set it to a default value of "Environments" image

Norrch2 commented 3 years ago

@trittimo thanks for the update.

I haven't considered this a factor since the EnvironmentsFolder is created when appsettings.json is generated.

Norrch2 commented 3 years ago

Hi, @trittimo I have created a PR to resolve this.