-
-
Notifications
You must be signed in to change notification settings - Fork 6
Fix runtime compatibility issues with .NET version mismatches #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- 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.
Summary of ChangesHello @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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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.
| 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]); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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]);
}There was a problem hiding this 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
Summary
Fixes MissingMethodException errors when plugin is compiled against a different .NET version than the ASF runtime.
Problem
The plugin throws
MissingMethodExceptionerrors 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
IWebProxyimplementation (SimpleWebProxy) that doesn't use anySystem.Net.WebProxyconstructorsSimpleHttpClientFactoryto useIWebProxyinterfaceLoggerFilterto pass theLinkedListdirectly instead of accessingnode.ListTest plan
dotnet build --configuration Release