René's URL Explorer Experiment


Title: PythonEngine fails to initialize in VSIX extension · pythonnet/pythonnet · Discussion #2405 · GitHub

Open Graph Title: PythonEngine fails to initialize in VSIX extension · pythonnet/pythonnet · Discussion #2405

X Title: PythonEngine fails to initialize in VSIX extension · pythonnet/pythonnet · Discussion #2405

Description: PythonEngine fails to initialize in VSIX extension

Open Graph Description: Environment Pythonnet version: 3.0.3, 3.1.0 Python version: 3.09 Operating System: Win11 .NET Runtime: 4.8 Details Describe what you were trying to get done. I am trying to use pythonnet package in...

X Description: Environment Pythonnet version: 3.0.3, 3.1.0 Python version: 3.09 Operating System: Win11 .NET Runtime: 4.8 Details Describe what you were trying to get done. I am trying to use pythonnet package in...

Opengraph URL: https://github.com/pythonnet/pythonnet/discussions/2405

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"PythonEngine fails to initialize in VSIX extension","text":"

Environment

\n\n

Details

\n\n

I am trying to use pythonnet package in a VSIX Visual Studio extension.
\nThe Experimental VS Instance initializes pythonnet fine, however deploying an extension causes this crash.
\nI suspect there may be some threading issues, but am not sure what to look for.

\n\n
try\n{\n    Runtime.PythonDLL = pythonFile.FullName;\n    PythonEngine.PythonHome = pythonFile.DirectoryName!;\n    OutputWindowHelper.LogInfo(\"PythonEngine\", \"Initializing Python engine.\");\n    PythonEngine.Initialize(); // crash here\n    PythonEngine.BeginAllowThreads();\n}\ncatch (Exception ex)\n{\n    OutputWindowHelper.LogError(ex);\n}\n
\n\n
[INFO] - PythonEngine: Initializing Python engine.\n[ERROR]: Object reference not set to an instance of an object.\n[TRACE]:    at Python.Runtime.ClassManager.GetClassInfo(Type type, ClassBase impl)\n   at Python.Runtime.ClassManager.InitClassBase(Type type, ClassBase impl, ReflectedClrType pyType)\n   at Python.Runtime.ReflectedClrType.GetOrCreate(Type type)\n   at Python.Runtime.ModuleObject.GetAttribute(String name, Boolean guess)\n   at Python.Runtime.ModuleObject.LoadNames()\n   at Python.Runtime.ImportHook.UpdateCLRModuleDict()\n   at Python.Runtime.PythonEngine.Initialize(IEnumerable`1 args, Boolean setSysArgv, Boolean initSigs)\n   at Python.Runtime.PythonEngine.Initialize()\n   at cpGames.VSA.ToolAPI.<InitializePythonEngineAsync>d__2.MoveNext() in ToolAPI.cs:line 69 // PythonEngine.Initialize(); call\n
","upvoteCount":2,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"

Why you close my issue?

\n

Here's your fix:

\n
internal static bool ShouldBindEvent(EventInfo ei)\n        {\n            var mb = ei.GetAddMethod(true);\n            if (mb == null)\n            {\n                return false;\n            }\n            return ShouldBindMethod(mb);\n        }\n
\n

Check your nulls, thank me later.

","upvoteCount":2,"url":"https://github.com/pythonnet/pythonnet/discussions/2405#discussioncomment-9850990"}}}

route-pattern/_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format)
route-controllervoltron_discussions_fragments
route-actiondiscussion_layout
fetch-noncev2:be287e78-ec10-6705-3698-3fe3e534c02b
current-catalog-service-hash9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be
request-idE41E:1298D8:30B12B7:41A0772:69706585
html-safe-noncee8e045c2f469c5e5eb04a3760c720b7f6a7468548f31e8de167ab31a689690f5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDFFOjEyOThEODozMEIxMkI3OjQxQTA3NzI6Njk3MDY1ODUiLCJ2aXNpdG9yX2lkIjoiNDUxNjY5NTczMDQ5MDE3NzMzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac2571b9e65ba1d5831f328f9538d7b37b4ed9352a337a808ee2fe79a03be19715
hovercard-subject-tagdiscussion:6850833
github-keyboard-shortcutsrepository,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/discussions_fragments/discussion_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/pythonnet/pythonnet/2405/discussion_layout
twitter:imagehttps://opengraph.githubassets.com/98aa3e9cf610d15ebcc4f7616bd33ff843d8a23985fc573e5820efdc8ae43e9f/pythonnet/pythonnet/discussions/2405
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/98aa3e9cf610d15ebcc4f7616bd33ff843d8a23985fc573e5820efdc8ae43e9f/pythonnet/pythonnet/discussions/2405
og:image:altEnvironment Pythonnet version: 3.0.3, 3.1.0 Python version: 3.09 Operating System: Win11 .NET Runtime: 4.8 Details Describe what you were trying to get done. I am trying to use pythonnet package in...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2
turbo-cache-controlno-preview
go-importgithub.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git
octolytics-dimension-user_id6050430
octolytics-dimension-user_loginpythonnet
octolytics-dimension-repository_id14748123
octolytics-dimension-repository_nwopythonnet/pythonnet
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id14748123
octolytics-dimension-repository_network_root_nwopythonnet/pythonnet
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
release7d6181066430cc06553c8396ca201e194ae33cb9
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/pythonnet/pythonnet/discussions/2405#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpythonnet%2Fpythonnet%2Fdiscussions%2F2405
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
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
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
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/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%2Fpythonnet%2Fpythonnet%2Fdiscussions%2F2405
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%2Fdiscussions_fragments%2Fdiscussion_layout&source=header-repo&source_repo=pythonnet%2Fpythonnet
Reloadhttps://github.com/pythonnet/pythonnet/discussions/2405
Reloadhttps://github.com/pythonnet/pythonnet/discussions/2405
Reloadhttps://github.com/pythonnet/pythonnet/discussions/2405
pythonnet https://github.com/pythonnet
pythonnethttps://github.com/pythonnet/pythonnet
Notifications https://github.com/login?return_to=%2Fpythonnet%2Fpythonnet
Fork 770 https://github.com/login?return_to=%2Fpythonnet%2Fpythonnet
Star 5.4k https://github.com/login?return_to=%2Fpythonnet%2Fpythonnet
Code https://github.com/pythonnet/pythonnet
Issues 155 https://github.com/pythonnet/pythonnet/issues
Pull requests 18 https://github.com/pythonnet/pythonnet/pulls
Discussions https://github.com/pythonnet/pythonnet/discussions
Actions https://github.com/pythonnet/pythonnet/actions
Projects 0 https://github.com/pythonnet/pythonnet/projects
Wiki https://github.com/pythonnet/pythonnet/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/pythonnet/pythonnet/security
Please reload this pagehttps://github.com/pythonnet/pythonnet/discussions/2405
Insights https://github.com/pythonnet/pythonnet/pulse
Code https://github.com/pythonnet/pythonnet
Issues https://github.com/pythonnet/pythonnet/issues
Pull requests https://github.com/pythonnet/pythonnet/pulls
Discussions https://github.com/pythonnet/pythonnet/discussions
Actions https://github.com/pythonnet/pythonnet/actions
Projects https://github.com/pythonnet/pythonnet/projects
Wiki https://github.com/pythonnet/pythonnet/wiki
Security https://github.com/pythonnet/pythonnet/security
Insights https://github.com/pythonnet/pythonnet/pulse
Answered https://github.com/pythonnet/pythonnet/discussions/2405#discussioncomment-9850990
cpgameshttps://github.com/cpgames
cpgames https://github.com/cpgames
Q&Ahttps://github.com/pythonnet/pythonnet/discussions/categories/q-a
PythonEngine fails to initialize in VSIX extension https://github.com/pythonnet/pythonnet/discussions/2405#top
cpgames https://github.com/cpgames
Answered https://github.com/pythonnet/pythonnet/discussions/2405#discussioncomment-9850990
cpgameshttps://github.com/cpgames
Return to tophttps://github.com/pythonnet/pythonnet/discussions/2405#top
Please reload this pagehttps://github.com/pythonnet/pythonnet/discussions/2405
https://github.com/pythonnet/pythonnet/discussions/2405
cpgames https://github.com/cpgames
Jun 22, 2024 https://github.com/pythonnet/pythonnet/discussions/2405#discussion-6850833
Minimal, Complete, and Verifiable examplehttp://stackoverflow.com/help/mcve
Give feedback.https://github.com/pythonnet/pythonnet/discussions/2405
cpgames https://github.com/cpgames
Jun 23, 2024 https://github.com/pythonnet/pythonnet/discussions/2405#discussioncomment-9850990
View full answer https://github.com/pythonnet/pythonnet/discussions/2405#discussioncomment-9850990
Oldest https://github.com/pythonnet/pythonnet/discussions/2405?sort=old
Newest https://github.com/pythonnet/pythonnet/discussions/2405?sort=new
Top https://github.com/pythonnet/pythonnet/discussions/2405?sort=top
Please reload this pagehttps://github.com/pythonnet/pythonnet/discussions/2405
https://github.com/pythonnet/pythonnet/discussions/2405
Please reload this pagehttps://github.com/pythonnet/pythonnet/discussions/2405
https://github.com/pythonnet/pythonnet/discussions/2405
cpgames https://github.com/cpgames
Jun 23, 2024 https://github.com/pythonnet/pythonnet/discussions/2405#discussioncomment-9850990
Give feedback.https://github.com/pythonnet/pythonnet/discussions/2405
cpgameshttps://github.com/cpgames
Please reload this pagehttps://github.com/pythonnet/pythonnet/discussions/2405
https://github.com/pythonnet/pythonnet/discussions/2405
Please reload this pagehttps://github.com/pythonnet/pythonnet/discussions/2405
https://github.com/pythonnet/pythonnet/discussions/2405
adrctr https://github.com/adrctr
Jul 8, 2024 https://github.com/pythonnet/pythonnet/discussions/2405#discussioncomment-9991087
https://private-user-images.githubusercontent.com/27783562/346699914-dbd88d82-7b22-4472-8f51-d3a5124e6ee7.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Njg5NzQwMDEsIm5iZiI6MTc2ODk3MzcwMSwicGF0aCI6Ii8yNzc4MzU2Mi8zNDY2OTk5MTQtZGJkODhkODItN2IyMi00NDcyLThmNTEtZDNhNTEyNGU2ZWU3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAxMjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMTIxVDA1MzUwMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTY0OTM4NDQxMzk0ZjUzOTZmMDk1MDE4MjRhZDVmZjIwNjcyMGFmOTUyMjUzZTRiYWFiOGNjNGQ4ZGZjMzc2YWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.mcM6mabM-gy_TDI1VCFVxsyiuzcVtuIUG1H5ilyvR1g
@cpgameshttps://github.com/cpgames
Give feedback.https://github.com/pythonnet/pythonnet/discussions/2405
Sign up for freehttps://github.com/join?source=comment-repo
Sign in to commenthttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpythonnet%2Fpythonnet%2Fdiscussions%2F2405
🙏 Q&A https://github.com/pythonnet/pythonnet/discussions/categories/q-a
https://github.com/cpgames
https://github.com/adrctr
#2404https://github.com/pythonnet/pythonnet/issues/2404
https://github.com/pythonnet/pythonnet/discussions/2405
https://github.com/settings/replies?return_to=1
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.