C#C
C#10mo ago
4 replies
Yawnder

✅ Issue with Collection Expression in the ubuntu-latest VM of Azure.

I have this build that fails in my azure pipeline with
The call is ambiguous between the following methods or properties: 'string.Split(char[]?, StringSplitOptions)' and 'string.Split(string?, StringSplitOptions)
, but it doesn't fail locally.
From what I understand, it's because of the difference in the SDK used locally, and the one used in the VM used by the build agent,
ubuntu-latest
. This SO answer highlights the reason, and how to address it: https://stackoverflow.com/a/78959408

How would you go about actually addressing it, considering that my pipeline's yml definition requests
ubuntu-latest
, so unless I actually downgrade to something older than a year or so, it will still happen right?

I know I can make the collection expression explicit (
["...", "..."]
to
new string[] { "...", "..." }
) but is there another way of addressing it.
Was this page helpful?