-
Notifications
You must be signed in to change notification settings - Fork 278
Improve DataRow type mismatch error messages with descriptive parameter information #5819
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5819 +/- ##
==========================================
- Coverage 72.90% 68.84% -4.06%
==========================================
Files 611 613 +2
Lines 38566 36142 -2424
==========================================
- Hits 28115 24883 -3232
- Misses 10451 11259 +808
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Try again copilot please |
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
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.
Do a test where multiple types are wrong, I think we should report only a single diagnostic and show the multple issues.
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Done! I've implemented support for reporting multiple type mismatches in a single diagnostic message. The analyzer now collects all type mismatches and formats them into one diagnostic, separated by semicolons. For example: "Parameter 's' expects type 'string', but the provided value has type 'int'; Parameter 'd' expects type 'decimal', but the provided value has type 'int'". Added test case
Successfully implemented the multiple type mismatches feature as requested in the previous comment. The analyzer now reports all type mismatches in a single diagnostic message rather than just the first one. (0893907) Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Summary
Improves the error message for DataRow type mismatches to provide clear, actionable information instead of confusing coordinate-like indices.
Problem
The current error message for DataRow type mismatches shows indices that look like coordinates, making it difficult for developers to understand what's wrong:
Before:
DataRow argument type should match method parameter type. Mismatches occur at indices: (2, 2)
This message is precise but unclear - it's not obvious that index 2 refers to the
price
parameter or that the issue is adouble
vsdecimal
type mismatch.Solution
After:
DataRow argument types do not match method parameter types. Parameter 'price' expects type 'decimal', but the provided value has type 'double'
This new message clearly identifies:
price
)decimal
)double
)Changes Made
Resources.resx
and all localization filesDataRowShouldBeValidAnalyzer.cs
to:ITypeSymbol.ToDisplayString()
for readable type namesExamples
Decimal vs Double (from issue)
Error:
Parameter 'price' expects type 'decimal', but the provided value has type 'double'
String vs Int
Error:
Parameter 's' expects type 'string', but the provided value has type 'int'
Array Type Mismatch
Error:
Parameter 'o' expects type 'object[]', but the provided value has type 'int'
Fixes #4996
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
5rqvsblobprodcus385.vsblob.vsassets.io
/home/REDACTED/work/testfx/testfx/.dotnet/dotnet msbuild /m /nologo /clp:Summary /v:minimal /nr:true /warnaserror /p:TreatWarningsAsErrors=true /p:ContinuousIntegrationBuild=false /home/REDACTED/work/testfx/testfx/artifacts/toolset/restore.proj /t:__WriteToolsetLocation /clp:ErrorsOnly;NoSummary /p:__ToolsetLocationOutputFile=/home/REDACTED/work/testfx/testfx/artifacts/toolset/10.0.0-beta.25316.2.txt
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.