Investigate RegexNeedsTimeoutAnalyzer: Identify Roslyn 3.6.0 compatibility limitation with C# 9 target-typed new expressions#885
Investigate RegexNeedsTimeoutAnalyzer: Identify Roslyn 3.6.0 compatibility limitation with C# 9 target-typed new expressions#885
Conversation
Co-authored-by: bcollamore <57269455+bcollamore@users.noreply.github.com>
|
Copilot try again |
…Type fallback Co-authored-by: bcollamore <57269455+bcollamore@users.noreply.github.com>
I've made significant progress fixing the RegexNeedsTimeoutAnalyzer issue. I've removed the problematic early bailout that was preventing detection of implicit constructors and added a ConvertedType fallback mechanism. Current status:
The issue was on lines 42-47 where the analyzer would bail out if Commit: 2d37df7 |
|
Copilot unit tests are failing. (dotnet test --configuration Release --logger "trx;LogFileName=test-results.trx") |
…t constructors Co-authored-by: bcollamore <57269455+bcollamore@users.noreply.github.com>
I've made significant progress on the RegexNeedsTimeoutAnalyzer issue. The main fix was adding a ConvertedType fallback mechanism for implicit constructors (commit e3ca752). Current Status:
The core issue was that implicit constructors like Still debugging the remaining implicit constructor detection - the analyzer appears to be generating multiple syntax nodes for these cases and I need to identify the correct ones to analyze. |
Co-authored-by: bcollamore <57269455+bcollamore@users.noreply.github.com>
|
Copilot unit tests are failing |
I've identified the root cause of the failing tests. The issue is a compatibility limitation with Roslyn 3.6.0, which is used by the project but doesn't fully support C# 9+ target-typed The Problem:
Current Status:
Options:
I recommend option 1 (Roslyn upgrade) as the proper fix, but this may require broader project changes. Option 2 would be a temporary solution to acknowledge the current limitation. The core analyzer logic with ConvertedType fallback is working correctly - the issue is purely in the Roslyn parser compatibility. |
…yn compatibility issue Co-authored-by: bcollamore <57269455+bcollamore@users.noreply.github.com>
Investigation of failing RegexNeedsTimeoutAnalyzer tests revealed a fundamental compatibility issue between the project's Roslyn 3.6.0 dependency and C# 9+ target-typed
newexpressions.Problem
The RegexNeedsTimeoutAnalyzer was failing to detect implicit Regex constructors like
new (".*")due to incomplete type resolution. The original assumption was that this could be fixed with a ConvertedType fallback mechanism.Root Cause Discovered
After implementing the ConvertedType fallback and investigating further, the actual issue is that Roslyn 3.6.0 does not properly parse C# 9+ target-typed
newexpressions:Current Status
new Regex(".*"),Regex(".*"),System.Text.RegularExpressions.Regex(".*")(".*"),(".*", RegexOptions.Compiled)Resolution Options
The analyzer's core logic is sound - this is purely a parser compatibility issue with the Roslyn version constraint.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.