C
C#2d ago
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.
4 Replies
reflectronic
reflectronic2d ago
an easy way to fix it is to install .NET 9 SDK in the build pipeline
Yawnder
YawnderOP2d ago
You mean like to add a step in the pipeline to install .net 9?
reflectronic
reflectronic2d ago
right
Yawnder
YawnderOP2d ago
Humn... Didn't think of that. Thanks for the idea.

Did you find this page helpful?