Skip to content
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

fix compiler issue re: Reverse() method in Test project. #2958

Merged
merged 3 commits into from
Feb 18, 2025

Conversation

TimothyMothra
Copy link
Member

@TimothyMothra TimothyMothra commented Feb 18, 2025

Discovered a new issue affecting test projects today.

CS0023 Operator '.' cannot be applied to operand of type 'void'

The problems appears to be with the use of the Reverse() method.
In each of the use cases, the Reverse() method is being called on an array of TelemetryDocument objects.
Each of the use cases are expecting to use the Linq Reverse method, which returns an IEnumerable and can be used to chain multiple methods.
Instead, the compiler has started selecting the Array Reverse method which returns a void which causes the above error.

I don't know what has caused the sudden breaking change. The last successful build was 2 weeks ago and was using .NET 8.0.12. Today's CI is using 8.0.13.

This PR fixes the issue by changing the order in which Reverse() is called to ensure it's being called on an Enumerable instead of on the Array type.

@TimothyMothra TimothyMothra changed the title investigating fix compiler issue re: Reverse() method Feb 18, 2025
@TimothyMothra TimothyMothra changed the title fix compiler issue re: Reverse() method fix compiler issue re: Reverse() method in Test project. Feb 18, 2025
@TimothyMothra TimothyMothra marked this pull request as ready for review February 18, 2025 22:41
Copy link

@Copilot 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 reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (3)

WEB/Src/PerformanceCollector/Perf.Tests/QuickPulse/QuickPulseTelemetryProcessorTests.cs:646

  • The second ToArray() call is redundant and should be removed.
var collectedTelemetry = accumulatorManager.CurrentDataAccumulator.TelemetryDocuments.Reverse().ToArray();

WEB/Src/PerformanceCollector/Perf.Tests/QuickPulse/QuickPulseTelemetryProcessorTests.cs:825

  • The second ToArray() call is redundant and should be removed.
Assert.AreEqual(TelemetryDocumentType.RemoteDependency.ToString(), accumulatorManager.CurrentDataAccumulator.TelemetryDocuments.Reverse().ToArray().Single().DocumentType);

WEB/Src/PerformanceCollector/Perf.Tests/QuickPulse/QuickPulseTelemetryProcessorTests.cs:3201

  • The Reverse() method was removed. Confirm if this change was intentional and doesn't affect the test logic.
var collectedTelemetry = accumulatorManager.CurrentDataAccumulator.TelemetryDocuments.ToArray().ToArray();

Copy link
Member

@rajkumar-rangaraj rajkumar-rangaraj left a comment

Choose a reason for hiding this comment

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

Please check copilot comments before the merge.

@TimothyMothra TimothyMothra enabled auto-merge (squash) February 18, 2025 23:03
@TimothyMothra TimothyMothra merged commit dd9ca70 into main Feb 18, 2025
82 checks passed
@TimothyMothra TimothyMothra deleted the tilee/202502_investigating branch February 18, 2025 23:13
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