René's URL Explorer Experiment


Title: Evaluate expression returns variable value from wrong scope · Issue #1882 · PowerShell/PowerShellEditorServices · GitHub

Open Graph Title: Evaluate expression returns variable value from wrong scope · Issue #1882 · PowerShell/PowerShellEditorServices

X Title: Evaluate expression returns variable value from wrong scope · Issue #1882 · PowerShell/PowerShellEditorServices

Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest version Search the existing issues. Steps to reproduce $myVarName = 123 & { $myVarName = 456 $myVarName # breakpoint here } While debugging the scr...

Open Graph Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest version Search the existing issues. Steps to reproduce $myVarName = 123 & { $myVarName = 456 $myVarName # b...

X Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest version Search the existing issues. Steps to reproduce $myVarName = 123 & { $myVarName = 456 $myVarName...

Opengraph URL: https://github.com/PowerShell/PowerShellEditorServices/issues/1882

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Evaluate expression returns variable value from wrong scope","articleBody":"### Prerequisites\r\n\r\n- [X] Write a descriptive title.\r\n- [X] Make sure you are able to repro it on the latest version\r\n- [X] Search the existing issues.\r\n\r\n### Steps to reproduce\r\n\r\n```powershell\r\n$myVarName = 123\r\n\u0026 {\r\n    $myVarName = 456\r\n    $myVarName           # breakpoint here\r\n}\r\n```\r\n\r\nWhile debugging the script above and stopped at line 4 (`$myVarName`), `evaluate` debugger call using `context: 'watch', expression: '$myVarName'` returns the value from parent scope (123).\r\n\r\nSimply changing the expression to `$myVarName;` returns the local value (456). This points us in the direction of this method as source of the bug.\r\nhttps://github.com/PowerShell/PowerShellEditorServices/blob/00238cdd8322241276b9691dd96f1f1b860bd1f9/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/DebugEvaluateHandler.cs#L63-L64\r\n\r\nThe evaluate-call in my scenario is made through using `new vscode.InlineValueEvaluatableExpression(range, expression)` which VSCode executes [here](https://github.com/microsoft/vscode/blob/13429c254b99fdc0b1d28056d5fd5e43e95f5c07/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts#L691-L703)\r\n\r\n### Expected behavior\r\n\r\n`evaluate` should return the local value (456). The local value is shown in Variable Explorer, PSIC and by inline using `vscode.InlineValueVariableLookup` while stopped at the same location.\r\n\r\n### Actual behavior\r\n\r\nReturns 123.\r\n\r\nAfter executing `$script:myVarName` or `$global:myVarName` in PSIC and using step over, `evaluate` returns the newest value (no scope-preference/-priority).\r\n\r\nChanging `$myVarName` in PSIC + step over updates variable explorer + `vscode.InlineValueVariableLookup` result, but `evaluate` doesn't care - still showing the latest parent-scope value.\r\n\r\n### Error details\r\n\r\n_No response_\r\n\r\n### Environment data\r\n\r\n```PowerShell\r\nName                           Value\r\n----                           -----\r\nPSVersion                      7.1.3\r\nPSEdition                      Core\r\nGitCommitId                    7.1.3\r\nOS                             Linux 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022\r\nPlatform                       Unix\r\nPSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion      2.3\r\nSerializationVersion           1.1.0.1\r\nWSManStackVersion              3.0\r\n```\r\n\r\n\r\n### Version\r\n\r\n2022.7.2\r\n\r\n### Visuals\r\n\r\n_No response_","author":{"url":"https://github.com/fflaten","@type":"Person","name":"fflaten"},"datePublished":"2022-08-12T19:28:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1882/PowerShellEditorServices/issues/1882"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:d0914e4b-40f4-f6b7-02fb-445d11fb66a6
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD5BC:CB9F0:990B24:CD737D:6A581CB5
html-safe-nonced78a85e6436018e764538f8c0684dccfe54e529b0ca4ffa4d66e3c9aff147b65
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENUJDOkNCOUYwOjk5MEIyNDpDRDczN0Q6NkE1ODFDQjUiLCJ2aXNpdG9yX2lkIjoiODY5ODg4MTc2MDcxMTY3OTE1NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacb500608ff4d4efcb02c31033fea1d21c02a3cd4b00ec49841b4c07da4d92eebd
hovercard-subject-tagissue:1337632037
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShellEditorServices/1882/issue_layout
twitter:imagehttps://opengraph.githubassets.com/dfc70bc3008806f105dee48dc1234c4ab1aa394afae573d3ec1ceb7493d3a19a/PowerShell/PowerShellEditorServices/issues/1882
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/dfc70bc3008806f105dee48dc1234c4ab1aa394afae573d3ec1ceb7493d3a19a/PowerShell/PowerShellEditorServices/issues/1882
og:image:altPrerequisites Write a descriptive title. Make sure you are able to repro it on the latest version Search the existing issues. Steps to reproduce $myVarName = 123 & { $myVarName = 456 $myVarName # b...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamefflaten
hostnamegithub.com
expected-hostnamegithub.com
None49c8c15fabcbf356d607a90ca115c13b273e42ff8b74155de050fd229a9b0121
turbo-cache-controlno-preview
go-importgithub.com/PowerShell/PowerShellEditorServices git https://github.com/PowerShell/PowerShellEditorServices.git
octolytics-dimension-user_id11524380
octolytics-dimension-user_loginPowerShell
octolytics-dimension-repository_id36031537
octolytics-dimension-repository_nwoPowerShell/PowerShellEditorServices
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id36031537
octolytics-dimension-repository_network_root_nwoPowerShell/PowerShellEditorServices
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release3fb1f684e7a833eb1b2d01d39875a2b52cb4fe9b
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/PowerShell/PowerShellEditorServices/issues/1882#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShellEditorServices%2Fissues%2F1882
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShellEditorServices%2Fissues%2F1882
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=PowerShell%2FPowerShellEditorServices
Reloadhttps://github.com/PowerShell/PowerShellEditorServices/issues/1882
Reloadhttps://github.com/PowerShell/PowerShellEditorServices/issues/1882
Reloadhttps://github.com/PowerShell/PowerShellEditorServices/issues/1882
Please reload this pagehttps://github.com/PowerShell/PowerShellEditorServices/issues/1882
PowerShell https://github.com/PowerShell
PowerShellEditorServiceshttps://github.com/PowerShell/PowerShellEditorServices
Notifications https://github.com/login?return_to=%2FPowerShell%2FPowerShellEditorServices
Fork 260 https://github.com/login?return_to=%2FPowerShell%2FPowerShellEditorServices
Star 759 https://github.com/login?return_to=%2FPowerShell%2FPowerShellEditorServices
Code https://github.com/PowerShell/PowerShellEditorServices
Issues 127 https://github.com/PowerShell/PowerShellEditorServices/issues
Pull requests 14 https://github.com/PowerShell/PowerShellEditorServices/pulls
Actions https://github.com/PowerShell/PowerShellEditorServices/actions
Security and quality 0 https://github.com/PowerShell/PowerShellEditorServices/security
Insights https://github.com/PowerShell/PowerShellEditorServices/pulse
Code https://github.com/PowerShell/PowerShellEditorServices
Issues https://github.com/PowerShell/PowerShellEditorServices/issues
Pull requests https://github.com/PowerShell/PowerShellEditorServices/pulls
Actions https://github.com/PowerShell/PowerShellEditorServices/actions
Security and quality https://github.com/PowerShell/PowerShellEditorServices/security
Insights https://github.com/PowerShell/PowerShellEditorServices/pulse
#2311https://github.com/PowerShell/PowerShellEditorServices/pull/2311
Evaluate expression returns variable value from wrong scopehttps://github.com/PowerShell/PowerShellEditorServices/issues/1882#top
#2311https://github.com/PowerShell/PowerShellEditorServices/pull/2311
Area-Debugginghttps://github.com/PowerShell/PowerShellEditorServices/issues?q=state%3Aopen%20label%3A%22Area-Debugging%22
Issue-BugA bug to squash.https://github.com/PowerShell/PowerShellEditorServices/issues?q=state%3Aopen%20label%3A%22Issue-Bug%22
Up for GrabsWill shepherd PRs.https://github.com/PowerShell/PowerShellEditorServices/issues?q=state%3Aopen%20label%3A%22Up%20for%20Grabs%22
https://github.com/fflaten
fflatenhttps://github.com/fflaten
on Aug 12, 2022https://github.com/PowerShell/PowerShellEditorServices/issues/1882#issue-1337632037
PowerShellEditorServices/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/DebugEvaluateHandler.cshttps://github.com/PowerShell/PowerShellEditorServices/blob/00238cdd8322241276b9691dd96f1f1b860bd1f9/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/DebugEvaluateHandler.cs#L63-L64
00238cdhttps://github.com/PowerShell/PowerShellEditorServices/commit/00238cdd8322241276b9691dd96f1f1b860bd1f9
herehttps://github.com/microsoft/vscode/blob/13429c254b99fdc0b1d28056d5fd5e43e95f5c07/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts#L691-L703
Area-Debugginghttps://github.com/PowerShell/PowerShellEditorServices/issues?q=state%3Aopen%20label%3A%22Area-Debugging%22
Issue-BugA bug to squash.https://github.com/PowerShell/PowerShellEditorServices/issues?q=state%3Aopen%20label%3A%22Issue-Bug%22
Up for GrabsWill shepherd PRs.https://github.com/PowerShell/PowerShellEditorServices/issues?q=state%3Aopen%20label%3A%22Up%20for%20Grabs%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.