Describe the bug
Using develop as our default branch led to GitVersion failing locally with an incomprehensible error.
System.InvalidOperationException : Sequence contains no matching element
Stack Trace:
Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
MainlineVersionCalculator.GetMainline(Commit baseVersionSource) line 133
MainlineVersionCalculator.FindMainlineModeVersion(BaseVersion baseVersion) line 44
NextVersionCalculator.FindVersion() line 59
Add origin/master to regex for master.
See PR #2379 test GivenARemoteGitRepositoryWithCommitsThenClonedLocalDevelopShouldMatchRemoteVersion
Using develop as the main branch without any configuration won't work. GitVersion has intrinsic knowledge and logic built around develop that requires master to exist. If you aren't going to have a master branch, why not just call it main as supported through #2367 (unreleased, but will still be easier and safer to configure)?
Master is our main branch. We have a master branch on the server, but when a developer is working locally it only exists as origin/master.
Why should a developer be required to checkout master locally to prevent GitVersion from reporting an error on build? They will never update master directly, that always happens by accepting a pull request in ADO.
In version used, I should have also specified that we are using GitVersionTask.
Although it's not a big job normalizing the repository so a local master is available, I agree it shouldn't be necessary. For some reason, it has become required. I'm not sure why or when, but I'll agree that it can be considered a bug.
I just stumbled upon the same problem, and I agree with OP that a dedicated error message would be very helpful.
A pull request that manages to pinpoint where and when this exception occurs and write a custom error message instead would be merged instantaneously.
Most helpful comment
Although it's not a big job normalizing the repository so a local
masteris available, I agree it shouldn't be necessary. For some reason, it has become required. I'm not sure why or when, but I'll agree that it can be considered a bug.