Skip to content

[WIP] Fix ImdsEndpoint naming to follow C# conventions#19

Open
Copilot wants to merge 1 commit intomainfrom
copilot/update-imds-endpoint-naming
Open

[WIP] Fix ImdsEndpoint naming to follow C# conventions#19
Copilot wants to merge 1 commit intomainfrom
copilot/update-imds-endpoint-naming

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 14, 2026

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt
Please apply the following diffs and create a pull request.
Once the PR is ready, give it a title based on the messages of the fixes being applied.

[{"message":"The field 'ImdsEndpoint' should follow C# naming conventions for private fields and be named '_imdsEndpoint' with a leading underscore and camelCase.","fixFiles":[{"filePath":"src/devhostagent/PortForward/ServicePortForwardConnector.cs","diff":"diff --git a/src/devhostagent/PortForward/ServicePortForwardConnector.cs b/src/devhostagent/PortForward/ServicePortForwardConnector.cs\n--- a/src/devhostagent/PortForward/ServicePortForwardConnector.cs\n+++ b/src/devhostagent/PortForward/ServicePortForwardConnector.cs\n@@ -25,7 +25,7 @@\n         private readonly int _port;\r\n         private readonly string _targetService;\r\n         private readonly ConcurrentDictionary<int, StreamHookData> _streams = new ConcurrentDictionary<int, StreamHookData>();\r\n-        private readonly string ImdsEndpoint = \"169.254.169.254\";\r\n+        private readonly string _imdsEndpoint = \"169.254.169.254\";\n         private const int _SocketBufferSize = 40960; // 40KB\r\n         private string loggingPrefix = \"\";\r\n         private readonly bool isManagedIdentity = false;\r\n@@ -60,7 +60,7 @@\n                 }\r\n                 else if (isManagedIdentity)\r\n                 {\r\n-                    tcpClient = new TcpClient(ImdsEndpoint, 80);\r\n+                    tcpClient = new TcpClient(_imdsEndpoint, 80);\n                 }\r\n                 else\r\n                 {\r\n"}]},{"message":"The field 'loggingPrefix' should follow C# naming conventions for private fields and be named '_loggingPrefix' with a leading underscore and camelCase.","fixFiles":[{"filePath":"src/devhostagent/PortForward/ServicePortForwardConnector.cs","diff":"diff --git a/src/devhostagent/PortForward/ServicePortForwardConnector.cs b/src/devhostagent/PortForward/ServicePortForwardConnector.cs\n--- a/src/devhostagent/PortForward/ServicePortForwardConnector.cs\n+++ b/src/devhostagent/PortForward/ServicePortForwardConnector.cs\n@@ -27,7 +27,7 @@\n         private readonly ConcurrentDictionary<int, StreamHookData> _streams = new ConcurrentDictionary<int, StreamHookData>();\r\n         private readonly string ImdsEndpoint = \"169.254.169.254\";\r\n         private const int _SocketBufferSize = 40960; // 40KB\r\n-        private string loggingPrefix = \"\";\r\n+        private string _loggingPrefix = \"\";\n         private readonly bool isManagedIdentity = false;\r\n \r\n         /// <summary>\r\n@@ -41,7 +41,7 @@\n             if (StringComparer.OrdinalIgnoreCase.Equals(_targetService, Common.Constants.ManagedIdentity.TargetServiceNameOnLocalMachine))\r\n             {\r\n                 isManagedIdentity = true;\r\n-                loggingPrefix = \"ManagedIdentity : \";\r\n+                _loggingPrefix = \"ManagedIdentity : \";\n             }\r\n         }\r\n \r\n"}]},{"message":"The field 'isManagedIdentity' should follow C# naming conventions for private fields and be named '_isManagedIdentity' with a leading underscore and camelCase.","fixFiles":[{"filePath":"src/devhostagent/PortForward/ServicePortForwardConnector.cs","diff":"diff --git a/src/devhostagent/PortForward/ServicePortForwardConnector.cs b/src/devhostagent/PortForward/ServicePortForwardConnector.cs\n--- a/src/devhostagent/PortForward/ServicePortForwardConnector.cs\n+++ b/src/devhostagent/PortForward/ServicePortForwardConnector.cs\n@@ -28,7 +28,7 @@\n         private readonly string ImdsEndpoint = \"169.254.169.254\";\r\n         private const int _SocketBufferSize = 40960; // 40KB\r\n         private string loggingPrefix = \"\";\r\n-        private readonly bool isManagedIdentity = false;\r\n+        private readonly bool _isManagedIdentity = false;\n \r\n         /// <summary>\r\n         /// Creates an instance that forwards another service's port.\r\n@@ -40,7 +40,7 @@\n             _log = log ?? throw new ArgumentNullException(nameof(log));\r\n             if (StringComparer.OrdinalIgnoreCase.Equals(_targetService, Common.Constants.ManagedIdentity.TargetServiceNameOnLocalMachine))\r\n             {\r\n-                isManagedIdentity = true;\r\n+                _isManagedIdentity = true;\n                 loggingPrefix = \"ManagedIdentity : \";\r\n             }\r\n         }\r\n"}]},{"message":"The .Forget() extension method suppresses exceptions from the async operation. Consider using proper error handling or at least logging exceptions that occur in the background task to avoid silent failures.","fixFiles":[{"filePath":"src/devhostagent/PortForward/ServicePortForwardConnector.cs","diff":"diff --git a/src/devhostagent/PortForward/ServicePortForwardConnector.cs b/src/devhostagent/PortForward/ServicePortForwardConnector.cs\n--- a/src/devhostagent/PortForward/ServicePortForwardConnector.cs\n+++ b/src/devhostagent/PortForward/ServicePortForwardConnector.cs\n@@ -70,7 +70,17 @@\n                 ...

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Copilot AI requested review from Copilot and removed request for Copilot March 14, 2026 06:07
@LukeLarge Lawrence Lucas Large (LukeLarge) marked this pull request as ready for review March 29, 2026 00:31
Copilot AI review requested due to automatic review settings March 29, 2026 00:31
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants