Commit dfb589d
committed
feat: Add C# 14 MemoryExtensions.Contains support to BingTextSearch
Support detection of MemoryExtensions.Contains patterns in LINQ filters
for C# 14 compatibility. In C# 14, Contains over arrays/collections now
resolves to MemoryExtensions.Contains instead of Enumerable.Contains due
to 'first-class spans' overload resolution changes.
Since Bing Search API does not support OR logic across multiple values,
collection Contains patterns (e.g., array.Contains(page.Property)) throw
clear NotSupportedException explaining the limitation and suggesting
alternatives.
Changes:
- Add System.Diagnostics.CodeAnalysis using for NotNullWhen attribute
- Enhance Contains case to distinguish instance vs static method calls
- Add IsMemoryExtensionsContains helper to detect C# 14 patterns
- Throw NotSupportedException for both Enumerable and MemoryExtensions
collection Contains patterns with clear actionable error messages
- Add 2 tests: collection Contains exception + String.Contains regression
Implements pattern awareness from PR #13263 by @roji
Addresses feedback on PR #13188 from @roji about C# 14 compatibility
Contributes to #10456 (LINQ filtering migration initiative)
Fixes #12504 compatibility for text search implementations1 parent e8060e7 commit dfb589d
2 files changed
Lines changed: 107 additions & 2 deletions
File tree
- dotnet/src/Plugins
- Plugins.UnitTests/Web/Bing
- Plugins.Web/Bing
Lines changed: 61 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
872 | 872 | | |
873 | 873 | | |
874 | 874 | | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
875 | 936 | | |
876 | 937 | | |
877 | 938 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
190 | | - | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
191 | 217 | | |
192 | 218 | | |
193 | 219 | | |
| |||
317 | 343 | | |
318 | 344 | | |
319 | 345 | | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
320 | 364 | | |
321 | 365 | | |
322 | 366 | | |
| |||
0 commit comments