GitVersion icon indicating copy to clipboard operation
GitVersion copied to clipboard

ReleaseDateFinder throws NullReferenceException

Open johnsimons opened this issue 12 years ago • 4 comments

The following error is thrown when there is no base version for a patch version.

System.NullReferenceException: Object reference not set to an instance of an object.
   at ReleaseDateFinder.Execute(IRepository repo, VersionAndBranch vab)
   at GitVersion.VersionForRepositoryFinder.GetVersion(Repository repository)
   at GitVersion.VersionCache.GetVersion(String gitDirectory)
   at GitVersionTask.VersionAndBranchFinder.TryGetVersion(String directory, VersionAndBranchAndDate& versionAndBranch)
   at GitVersionTask.WriteVersionInfoToBuildLog.InnerExecute()
   at GitVersionTask.WriteVersionInfoToBuildLog.Execute()   NServiceBus.Distributor.MSMQ

So I came across this issue because we decided to split one of our assemblies into its own repo. The assembly is already released with version 4.4.2 and I wanted to release a patch version (4.4.3) in the new repo, but because the new repo does not have a 4.4.0 tag, the code fails. The workaround was to add a 4.4.0 tag, but I wonder if in this situation we should just set the release date to the patch date ?

johnsimons avatar Mar 27 '14 05:03 johnsimons

Since this situation should only happen when doing repo splits how about we just throw a better exception that explains what needs to be done? (adding the tag)

andreasohlund avatar Apr 13 '14 18:04 andreasohlund

I'm getting this same exception when trying to use the GitVersionTask from MSBuild. It isn't clear to me why I'm getting this error, as I have tags 1.0.0, 1.1.0, and 1.1.1 all setup in master.

How can I go about debugging this to determine why I'm getting the error?

Bishbulb avatar Sep 09 '14 18:09 Bishbulb

Figured out my issue - turns out one of my tags wasn't pushed to master, so GitVersion.exe was failing when run on the build server.

I agree that a more useful error message would be helpful here.

Bishbulb avatar Sep 10 '14 13:09 Bishbulb

fixed in https://github.com/Particular/GitVersion/commit/6ea71e1e89859fbf821185bd879eb3a9b8ce7bda

SimonCropp avatar Oct 08 '14 22:10 SimonCropp