Skip to content

Conversation

@Berisch
Copy link

@Berisch Berisch commented Nov 26, 2025

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 throws MissingMethodException 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 custom IWebProxy implementation (SimpleWebProxy) that doesn't use any System.Net.WebProxy constructors
  2. Changed SimpleHttpClientFactory to use IWebProxy interface
  3. Fixed LoggerFilter to pass the LinkedList directly instead of accessing node.List

Test plan

  • Built successfully with dotnet 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 builds

Fixes MissingMethodException errors when plugin is compiled against
a 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 our documentation 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.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays 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 found here.

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 up here.

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

Footnotes

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

Copy link

@gemini-code-assist gemini-code-assist bot 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 of SimpleWebProxy to avoid problematic WebProxy constructors and the fix in LoggerFilter to avoid LinkedListNode.List are excellent solutions to the MissingMethodException 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 splitting uri.UserInfo to parse credentials can fail if the password contains a colon. Using Split(':') will result in more than two parts, causing the if (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 = new NetworkCredential(split[0], split[1]);
				}

Copy link

@agscs agscs left a comment

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 free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants