public async Task <BuildData> StartNewBuild() { if (!isLoaded) { await loadTask.Task; } uint buildNumber; lock (buildNumberLock) { if (LastBuild == null) { LastBuild = new ProjectLastBuild(); } LastBuild.Number++; LastBuild.Time = DateTime.Now; buildNumber = LastBuild.Number; } try { SaveLastBuild(); } catch (Exception error) { Log.Error("Failed to update project lastBuild file!", error); } var newBuild = Builds.New(buildNumber); if (Description.MaxBuilds.HasValue) { try { Builds.Cleanup((int)Description.MaxBuilds.Value); } catch {} } return(newBuild); }