René's URL Explorer Experiment


Title: Workarounds in loading assembly with different versions · Issue #11571 · PowerShell/PowerShell · GitHub

Open Graph Title: Workarounds in loading assembly with different versions · Issue #11571 · PowerShell/PowerShell

X Title: Workarounds in loading assembly with different versions · Issue #11571 · PowerShell/PowerShell

Description: In our particular case, we have a custom shell around ConsoleShell that upon start up loads Microsoft.WindowsAzure.Storage.dll into the current app domain. Once the shell is up, we couldn't import for example Az.Accounts module because i...

Open Graph Description: In our particular case, we have a custom shell around ConsoleShell that upon start up loads Microsoft.WindowsAzure.Storage.dll into the current app domain. Once the shell is up, we couldn't import ...

X Description: In our particular case, we have a custom shell around ConsoleShell that upon start up loads Microsoft.WindowsAzure.Storage.dll into the current app domain. Once the shell is up, we couldn't imp...

Opengraph URL: https://github.com/PowerShell/PowerShell/issues/11571

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Workarounds in loading assembly with different versions","articleBody":"In our particular case, we have a custom shell around `ConsoleShell` that upon start up loads `Microsoft.WindowsAzure.Storage.dll` into the current app domain. Once the shell is up, we couldn't import for example `Az.Accounts` module because it depends on a different version of `Microsoft.WindowsAzure.Storage.dll`. Since this is a more general problem with PowerShell Core, I posted the issue here instead of over at Azure PowerShell. Effectively, I'm looking for a workaround for issue https://github.com/PowerShell/PowerShell/issues/2083.\r\n\r\n## Attempt 1:\r\ncustom assembly resolve\r\n```\r\nusing Microsoft.PowerShell;\r\nusing System;\r\nusing System.Diagnostics;\r\nusing System.Reflection;\r\n\r\nnamespace Test\r\n{\r\n    class Program\r\n    {\r\n        static void Main(string[] args)\r\n        {\r\n            AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve;\r\n\r\n            ConsoleShell.Start(\"Hello\", \"\", new string[0] { });\r\n        }\r\n\r\n        private static Assembly OnAssemblyResolve(object sender, ResolveEventArgs args)\r\n        {\r\n            Debugger.Launch();\r\n            return null;\r\n        }\r\n    }\r\n}\r\n```\r\n```\r\n\u003cProject Sdk=\"Microsoft.NET.Sdk\">\r\n\r\n  \u003cPropertyGroup>\r\n    \u003cOutputType>Exe\u003c/OutputType>\r\n    \u003cTargetFramework>netcoreapp3.1\u003c/TargetFramework>\r\n  \u003c/PropertyGroup>\r\n\r\n  \u003cItemGroup>\r\n    \u003cPackageReference Include=\"Microsoft.PowerShell.SDK\" Version=\"7.0.0-rc.1\" />\r\n  \u003c/ItemGroup>\r\n\r\n  \u003cItemGroup>\r\n    \u003cReference Include=\"Microsoft.PowerShell.ConsoleHost\">\r\n      \u003cHintPath>$(NuGetPackageRoot)\\microsoft.powershell.consolehost\\7.0.0-rc.1\\runtimes\\win\\lib\\netcoreapp3.1\\Microsoft.PowerShell.ConsoleHost.dll\u003c/HintPath>\r\n    \u003c/Reference>\r\n  \u003c/ItemGroup>\r\n\r\n\u003c/Project>\r\n```\r\n## Problem:\r\nWhen run two import (`Import-Module C:\\version1\\assembly.dll; Import-Module C:\\version2\\assembly.dll`) with different versions of the assembly, I hit error of `Import-Module: Assembly with same name is already loaded` but the `AssemblyResolve` event was not raised.  \r\n\r\n## Attempt 2:\r\nbinding redirect through config file\r\n```\r\n\u003cassemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\">\r\n  \u003cdependentAssembly>\r\n    \u003cassemblyIdentity name=\"Microsoft.WindowsAzure.Storage\" publicKeyToken=\"31bf3856ad364e35\" culture=\"neutral\" />\r\n    \u003cbindingRedirect oldVersion=\"0.0.0.0-9.3.3.0\" newVersion=\"9.3.3.0\" />\r\n  \u003c/dependentAssembly>\r\n\u003c/assemblyBinding>\r\n```\r\n## Problem:\r\nRun into the same error above\r\n\r\n## Attempt 3:\r\nrun any external commands with Invoke-Command -Session, this basically out-sourced the command on a different app domain and avoid the version collision.\r\n## Problem:\r\nThis seems to be the only workaround I can come up with, but it's really inconvenient to jump back and forth PS sessions.\r\n\r\n## Question:\r\nAny better workaround?","author":{"url":"https://github.com/ritchxu","@type":"Person","name":"ritchxu"},"datePublished":"2020-01-13T19:13:24Z","url":"https://github.com/PowerShell/PowerShell/issues/11571"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:3a1c3536-1838-9ec9-5e9b-606efd3258a2
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE40E:238DBE:F5725:15B86B:6AFD4C78
html-safe-noncef15d4e24914b82895c0726f8a4e3f326c83dec4789d86bc99f89149a1a786f9a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDBFOjIzOERCRTpGNTcyNToxNUI4NkI6NkFGRDRDNzgiLCJ2aXNpdG9yX2lkIjoiMTU2MzU2MTMyMzgyMjY2NDgyNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaca49c085bcbd039adb57d6487a33a3e418792b3b1bd47430a27e88738e6be6bdb
hovercard-subject-tagissue:549126619
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/PowerShell/11571/issue_layout
twitter:imagehttps://opengraph.githubassets.com/c599e4f3a2871f2e4df157f5938a2202067cd895502a3c9afc1cfcc884d21b84/PowerShell/PowerShell/issues/11571
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/c599e4f3a2871f2e4df157f5938a2202067cd895502a3c9afc1cfcc884d21b84/PowerShell/PowerShell/issues/11571
og:image:altIn our particular case, we have a custom shell around ConsoleShell that upon start up loads Microsoft.WindowsAzure.Storage.dll into the current app domain. Once the shell is up, we couldn't import ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameritchxu
hostnamegithub.com
expected-hostnamegithub.com
None66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e
turbo-cache-controlno-preview
go-importgithub.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git
octolytics-dimension-user_id11524380
octolytics-dimension-user_loginPowerShell
octolytics-dimension-repository_id49609581
octolytics-dimension-repository_nwoPowerShell/PowerShell
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id49609581
octolytics-dimension-repository_network_root_nwoPowerShell/PowerShell
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
releaseb6f01f7cb9f35f8c09949773241a3d49dd04b340
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/PowerShell/PowerShell/issues/11571#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F11571
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F11571
Sign uphttps://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%2FPowerShell
Reloadhttps://github.com/PowerShell/PowerShell/issues/11571
Reloadhttps://github.com/PowerShell/PowerShell/issues/11571
Reloadhttps://github.com/PowerShell/PowerShell/issues/11571
PowerShellhttps://github.com/PowerShell
PowerShellhttps://github.com/PowerShell/PowerShell
Codehttps://github.com/PowerShell/PowerShell
Issues1.3k (1.3k)https://github.com/PowerShell/PowerShell/issues
Pull requests365 (365)https://github.com/PowerShell/PowerShell/pulls
Discussionshttps://github.com/PowerShell/PowerShell/discussions
Actionshttps://github.com/PowerShell/PowerShell/actions
Projectshttps://github.com/PowerShell/PowerShell/projects
Security and quality3 (3)https://github.com/PowerShell/PowerShell/security
Insightshttps://github.com/PowerShell/PowerShell/insights
https://github.com/PowerShell/PowerShell
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/11571
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/11571
Workarounds in loading assembly with different versionshttps://github.com/PowerShell/PowerShell/issues/11571#top
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get ahttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Question%22
Resolution-AnsweredThe question is answered.https://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-Answered%22
WG-Enginecore PowerShell engine, interpreter, and runtimehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Engine%22
https://github.com/ritchxu
Ray Xu (ritchxu)https://github.com/ritchxu
on Jan 13, 2020https://github.com/PowerShell/PowerShell/issues/11571#issue-549126619
#2083https://github.com/PowerShell/PowerShell/issues/2083
Ray Xu (ritchxu)https://github.com/ritchxu
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get ahttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Question%22
on Jan 13, 2020https://github.com/PowerShell/PowerShell/issues/11571#event-2944421866
https://github.com/iSazonov
Ilya (iSazonov)https://github.com/iSazonov
on Jan 14, 2020https://github.com/PowerShell/PowerShell/issues/11571#issuecomment-574139617
Dongbo Wang (@daxian-dbw)https://github.com/daxian-dbw
Ilya (iSazonov)https://github.com/iSazonov
WG-Enginecore PowerShell engine, interpreter, and runtimehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Engine%22
on Jan 14, 2020https://github.com/PowerShell/PowerShell/issues/11571#event-2946763082
https://github.com/SeeminglyScience
Patrick Meinecke (SeeminglyScience)https://github.com/SeeminglyScience
on Jan 14, 2020https://github.com/PowerShell/PowerShell/issues/11571#issuecomment-574173439
Rob Holt (@rjmholt)https://github.com/rjmholt
Here's the load context classhttps://github.com/PowerShell/PowerShellEditorServices/blob/81ba0c0b8efb7ee879f2ede511390ba73b0bc86e/src/PowerShellEditorServices.Hosting/Internal/PsesLoadContext.cs
here's where he sets it up for usehttps://github.com/PowerShell/PowerShellEditorServices/blob/81ba0c0b8efb7ee879f2ede511390ba73b0bc86e/src/PowerShellEditorServices.Hosting/EditorServicesLoader.cs#L79-L109
https://github.com/rjmholt
Rob Holt (rjmholt)https://github.com/rjmholt
on Jan 14, 2020https://github.com/PowerShell/PowerShell/issues/11571#issuecomment-574384979
Rob Holt (@rjmholt)https://github.com/rjmholt
https://github.com/rjmholt
Rob Holt (rjmholt)https://github.com/rjmholt
on Jan 14, 2020https://github.com/PowerShell/PowerShell/issues/11571#issuecomment-574388170
https://github.com/ritchxu
Ray Xu (ritchxu)https://github.com/ritchxu
on Jan 14, 2020https://github.com/PowerShell/PowerShell/issues/11571#issuecomment-574407697
Rob Holt (@rjmholt)https://github.com/rjmholt
https://github.com/daxian-dbw
Dongbo Wang (daxian-dbw)https://github.com/daxian-dbw
on Jan 14, 2020https://github.com/PowerShell/PowerShell/issues/11571#issuecomment-574408088
https://github.com/SeeminglyScience
Patrick Meinecke (SeeminglyScience)https://github.com/SeeminglyScience
on Jan 14, 2020https://github.com/PowerShell/PowerShell/issues/11571#issuecomment-574410150
https://github.com/rjmholt
Rob Holt (rjmholt)https://github.com/rjmholt
on Jan 14, 2020https://github.com/PowerShell/PowerShell/issues/11571#issuecomment-574413202
https://github.com/ritchxu
Ray Xu (ritchxu)https://github.com/ritchxu
on Jan 16, 2020https://github.com/PowerShell/PowerShell/issues/11571#issuecomment-575348909
Rob Holt (@rjmholt)https://github.com/rjmholt
https://github.com/ritchxu
Ray Xu (ritchxu)https://github.com/ritchxu
on Jan 17, 2020https://github.com/PowerShell/PowerShell/issues/11571#issuecomment-575795048
https://github.com/rjmholt
Rob Holt (rjmholt)https://github.com/rjmholt
on Jan 17, 2020https://github.com/PowerShell/PowerShell/issues/11571#issuecomment-575816344
https://github.com/rjmholt
Rob Holt (rjmholt)https://github.com/rjmholt
on Jan 17, 2020https://github.com/PowerShell/PowerShell/issues/11571#issuecomment-575816989
Ilya (iSazonov)https://github.com/iSazonov
Resolution-AnsweredThe question is answered.https://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-Answered%22
on Jan 31, 2020https://github.com/PowerShell/PowerShell/issues/11571#event-2997348897
completedhttps://github.com/PowerShell/PowerShell/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Feb 2, 2020https://github.com/PowerShell/PowerShell/issues/11571#event-2999681053
Sign up for freehttps://github.com/signup?return_to=https://github.com/PowerShell/PowerShell/issues/11571
Sign in to commenthttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/11571
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get ahttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Question%22
Resolution-AnsweredThe question is answered.https://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-Answered%22
WG-Enginecore PowerShell engine, interpreter, and runtimehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22WG-Engine%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.