jakeswenson / BitBetter

Modify bit warden to provide my own licensing for self hosting
500 stars 112 forks source link

license generation fails #109

Closed Jniklas2 closed 3 years ago

Jniklas2 commented 3 years ago

I'm trying to generate a license for an organization, but it fails with this error:

Oops: System.ArgumentException: Object of type 'System.Int16' cannot be converted to type 'System.Nullable`1[System.Int32]'. at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast) at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr) at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig) at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index) at System.Reflection.PropertyInfo.SetValue(Object obj, Object value) at bitwardenSelfLicensor.Program.<GenerateOrgLicense>g__set|8_0(String name, Object value, <>c__DisplayClass8_0& ) in /licenseGen/Program.cs:line 395 at bitwardenSelfLicensor.Program.GenerateOrgLicense(X509Certificate2 cert, String corePath, String userName, String email, Int16 storage, Guid instalId, String businessName, String key) in /licenseGen/Program.cs:line 407 at bitwardenSelfLicensor.Program.<>c__DisplayClass0_1.<Main>b__7() in /licenseGen/Program.cs:line 152 at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) at bitwardenSelfLicensor.Program.Main(String[] args) in /licenseGen/Program.cs:line 286

But creating a user license works fine. I've tested it on 2 different servers (1 with an already working installation and one completely new). Both are running Debian 10.

Groovin-Dev commented 3 years ago

I fixed it by removing the short conversion on line 407 of Program.cs. Not too sure why it's failing because of that but removing it, rebuilding, and rerunning generates the license like it should and it works.

https://github.com/jakeswenson/BitBetter/blob/21bffcf262993005397404645ecbb2af4228f8ad/src/licenseGen/Program.cs#L407

Jniklas2 commented 3 years ago

I fixed it by removing the short conversion on line 407 of Program.cs. Not too sure why it's failing because of that but removing it, rebuilding, and rerunning generates the license like it should and it works.

https://github.com/jakeswenson/BitBetter/blob/21bffcf262993005397404645ecbb2af4228f8ad/src/licenseGen/Program.cs#L407

Thanks for the tip. Now it works again