Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

Fix runtime compatibility issues with .NET version mismatches#134

Open
Berisch wants to merge 1 commit intomaxisoft:mainfrom
Berisch:fix/runtime-compatibility
Open

Fix runtime compatibility issues with .NET version mismatches#134
Berisch wants to merge 1 commit intomaxisoft:mainfrom
Berisch:fix/runtime-compatibility

Conversation

@Berisch
Copy link

Summary

  • Add SimpleWebProxy class to avoid WebProxy constructor signature mismatches
  • Update SimpleHttpClientFactory to use IWebProxy interface instead of WebProxy
  • Fix LinkedListNode.List property access in LoggerFilter
  • Add TreatWarningsAsErrors override for Release builds

Fixes MissingMethodException errors when plugin is compiled against a different .NET version than the ASF runtime.

Problem

The plugin throwsMissingMethodException errors like:
Method not found: 'Void System.Net.WebProxy..ctor(System.String, Boolean)' Method not found: 'System.Collections.Generic.LinkedList1<!0> System.Collections.Generic.LinkedListNode1.get_List()'

This happens when the plugin is compiled against a different .NET version than the ASF runtime.

Solution

  1. Created a customIWebProxy implementation (SimpleWebProxy) that doesn't use anySystem.Net.WebProxy constructors
  2. ChangedSimpleHttpClientFactory to useIWebProxy interface
  3. FixedLoggerFilter to pass theLinkedList directly instead of accessingnode.List

Test plan

  • Built successfully withdotnet build --configuration Release
  • Tested with ASF - plugin loads and works without errors

- Add SimpleWebProxy class to avoid WebProxy constructor signature mismatches- Update SimpleHttpClientFactory to use IWebProxy interface instead of WebProxy- Fix LinkedListNode.List property access in LoggerFilter- Add TreatWarningsAsErrors override for Release buildsFixes MissingMethodException errors when plugin is compiled againsta different .NET version than the ASF runtime.
@gemini-code-assist
Copy link

Summary of Changes

Hello@Berisch, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses critical runtime compatibility issues, specifically "MissingMethodException" errors, that arise when the plugin is compiled against a different .NET version than the ASF runtime. The primary solution involves refactoring the HTTP client's proxy handling to use a custom "IWebProxy" implementation, thereby avoiding direct reliance on potentially mismatched "System.Net.WebProxy" constructors. Additionally, it fixes a "LinkedList" access pattern in the logger filter and adjusts build settings to prevent warnings from halting release builds.

Highlights

  • Proxy Handling Refactor: Introduced a custom "SimpleWebProxy" class implementing "IWebProxy" to abstract away "System.Net.WebProxy" and prevent "MissingMethodException" due to constructor signature mismatches across .NET versions.
  • HttpClient Factory Update: Modified "SimpleHttpClientFactory" to utilize the "IWebProxy" interface for proxy management, ensuring compatibility and proper caching logic without direct "WebProxy" type references.
  • Logger Filter Fix: Corrected an issue in "LoggerFilter" where "LinkedListNode.List" property access could cause "MissingMethodException" by passing the "LinkedList" directly to the disposable helper.
  • Build Configuration Adjustment: Added an override in "Directory.Build.props" to set "TreatWarningsAsErrors" to "false" for Release builds, allowing for more flexible compilation with ASF's nullable warnings.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on ourdocumentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either/gemini <command> or@gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

FeatureCommandDescription
Code Review/gemini reviewPerforms a code review for the current pull request in its current state.
Pull Request Summary/gemini summaryProvides a summary of the current pull request in its current state.
Comment@gemini-code-assistResponds in comments when explicitly tagged, both in pull request comments and review comments.
Help/gemini helpDisplays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a.gemini/ folder in the base of the repository. Detailed instructions can be foundhere.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on@gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign uphere.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with theGemini Code Assist IDE Extension.

Footnotes

  1. Review thePrivacy Notices,Generative AI Prohibited Use Policy,Terms of Service, and learn how to configure Gemini Code Assist in GitHubhere. Gemini can make mistakes, so double check it anduse code with caution.

Copy link

@gemini-code-assistgemini-code-assistbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Code Review

This pull request effectively resolves runtime compatibility issues caused by .NET version mismatches. The introduction ofSimpleWebProxy to avoid problematicWebProxy constructors and the fix inLoggerFilter to avoidLinkedListNode.List are excellent solutions to theMissingMethodException errors. The changes are well-targeted and the reasoning is clear. I have one suggestion to improve the robustness of proxy credential parsing. Overall, great work on improving the plugin's stability across different environments.

Comment on lines 46 to 50
string[] split = uri.UserInfo.Split(':');

if (split.Length == 2) {
webProxy.Credentials = new NetworkCredential(split[0], split[1]);
simpleProxy.Credentials = new NetworkCredential(split[0], split[1]);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

medium

The current method of splittinguri.UserInfo to parse credentials can fail if the password contains a colon. UsingSplit(':') will result in more than two parts, causing theif (split.Length == 2) check to fail and preventing credentials from being set. To make this more robust, you should split on the first colon only.

string[]split=uri.UserInfo.Split(new[]{':'},2);if(split.Length==2){simpleProxy.Credentials=newNetworkCredential(split[0],split[1]);}

Copy link

@agscsagscs left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It need more verification for this AI slop, as im not that good with C# :P

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

2 more reviewers

@agscsagscsagscs left review comments

@gemini-code-assistgemini-code-assist[bot]gemini-code-assist[bot] left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@Berisch@agscs

[8]ページ先頭

©2009-2026 Movatter.jp