Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitversion init - Option 5) Branch Increment mode crashes with an InvalidOperationException #1942

Closed
dsbut opened this issue Dec 2, 2019 · 8 comments · Fixed by #1943
Closed
Labels
Milestone

Comments

@dsbut
Copy link

dsbut commented Dec 2, 2019

I am using GitVersion for the first time, and exploring the various options available in gitversion init.

Choosing 5) Branch Increment mode (per commit/after tage) (Current: ) always results in a System.InvlidOperationException being throw, and the GitVersion process crashes and exits.

This problem is reproducible in 100% of various attempts with GitVersion 5.1.2.

Repro steps

  1. Execute gitversion init from repository root.
  2. Choose option 5)

Result

GitVersion init will guide you through setting GitVersion up to work for you

Which would you like to change?

0) Save changes and exit
1) Exit without saving

2) Run getting started wizard

3) Set next version number
4) Branch specific configuration
5) Branch Increment mode (per commit/after tag) (Current: )
6) Assembly versioning scheme (Current: )
7) Setup build scripts

> 5
ERROR [12/02/19 16:49:00:95] An unexpected error occurred:
System.InvalidOperationException: A suitable constructor for type 'GitVersion.Configuration.Init.SetConfig.GlobalModeSetting' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor.
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, Type serviceType, Type implementationType, CallSiteChain callSiteChain)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, Int32 slot)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(Type serviceType, CallSiteChain callSiteChain)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateCallSite(Type serviceType, CallSiteChain callSiteChain)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.<>c__DisplayClass7_0.<GetCallSite>b__0(Type type)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.GetCallSite(Type serviceType, CallSiteChain callSiteChain)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.CreateServiceAccessor(Type serviceType)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
   at GitVersion.Configuration.Init.Wizard.ConfigInitStepFactory.CreateStep[T]()
   at GitVersion.Configuration.Init.EditConfigStep.HandleResult(String result, Queue`1 steps, Config config, String workingDirectory)
   at GitVersion.Configuration.Init.Wizard.ConfigInitWizardStep.Apply(Queue`1 steps, Config config, String workingDirectory)
   at GitVersion.Configuration.Init.Wizard.ConfigInitWizard.Run(Config config, String workingDirectory)
   at GitVersion.Configuration.ConfigProvider.Init(String workingDirectory)
   at GitVersion.GitVersionExecutor.VerifyArgumentsAndRun(Arguments arguments)
INFO [12/02/19 16:49:00:95]
INFO [12/02/19 16:49:00:95] Attempting to show the current git graph (please include in issue):
INFO [12/02/19 16:49:00:95] Showing max of 100 commits
INFO [12/02/19 16:49:01:38] * 689f1b7 72 seconds ago  (HEAD -> master, develop)

INFO [12/02/19 16:48:46:22] Working directory: C:\Dev\Kortext\GitMigration\test-repoINFO [12/02/19 16:48:46:23] IsDynamicGitRepository: FalseINFO [12/02/19 16:48:46:42] Returning Project Root from DotGitDirectory: C:\Dev\Kortext\GitMigration\test-repo\.git\ - C:\Dev\Kortext\GitMigration\test-repo\ERROR [12/02/19 16:49:00:95] An unexpected error occurred:
System.InvalidOperationException: A suitable constructor for type 'GitVersion.Configuration.Init.SetConfig.GlobalModeSetting' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor.
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, Type serviceType, Type implementationType, CallSiteChain callSiteChain)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, Int32 slot)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(Type serviceType, CallSiteChain callSiteChain)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateCallSite(Type serviceType, CallSiteChain callSiteChain)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.<>c__DisplayClass7_0.<GetCallSite>b__0(Type type)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.GetCallSite(Type serviceType, CallSiteChain callSiteChain)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.CreateServiceAccessor(Type serviceType)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
   at GitVersion.Configuration.Init.Wizard.ConfigInitStepFactory.CreateStep[T]()
   at GitVersion.Configuration.Init.EditConfigStep.HandleResult(String result, Queue`1 steps, Config config, String workingDirectory)
   at GitVersion.Configuration.Init.Wizard.ConfigInitWizardStep.Apply(Queue`1 steps, Config config, String workingDirectory)
   at GitVersion.Configuration.Init.Wizard.ConfigInitWizard.Run(Config config, String workingDirectory)
   at GitVersion.Configuration.ConfigProvider.Init(String workingDirectory)
   at GitVersion.GitVersionExecutor.VerifyArgumentsAndRun(Arguments arguments)INFO [12/02/19 16:49:00:95] INFO [12/02/19 16:49:00:95] Attempting to show the current git graph (please include in issue): INFO [12/02/19 16:49:00:95] Showing max of 100 commitsINFO [12/02/19 16:49:01:38] * 689f1b7 72 seconds ago  (HEAD -> master, develop)
arturcic added a commit to arturcic/GitVersion that referenced this issue Dec 3, 2019
@arturcic arturcic mentioned this issue Dec 3, 2019
@arturcic arturcic added this to the 5.1.3 milestone Dec 3, 2019
arturcic added a commit that referenced this issue Dec 3, 2019
@arturcic
Copy link
Member

arturcic commented Dec 3, 2019

@dsbut thanks for catching this bug, can you try 5.1.3-beta.1+40 version when available and see if the fix works for you

@dsbut
Copy link
Author

dsbut commented Dec 4, 2019

@arturcic Yes - 5.1.3-beta.1+40 has fixed the problem.

@arturcic
Copy link
Member

arturcic commented Dec 4, 2019

@dsbut great, thanks for sharing

@Giorgi
Copy link

Giorgi commented Jan 4, 2023

I'm still getting this error. Tried latest 5.11.1 version as well as 6.0.0-alpha.1

image

@ian-iress
Copy link

Looks like the fix was reverted here - 666bd37

@KinableJan
Copy link

Why is this issue closed? I'm still facing the same error.

@asbjornu
Copy link
Member

asbjornu commented Oct 4, 2023

Hmyea, seems like we need to change GlobalModeSetting.ctor from protected to public again as in 37c67a0.

protected GlobalModeSetting(IConsole console, IFileSystem fileSystem, ILog log, IConfigInitStepFactory stepFactory) : base(console, fileSystem, log, stepFactory)

@arturcic
Copy link
Member

@asbjornu I will close this issue as we removed the init config entirely in v6

@arturcic arturcic closed this as not planned Won't fix, can't repro, duplicate, stale Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants