-
Notifications
You must be signed in to change notification settings - Fork 648
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
Providing an empty license string throws an exception #7060
Comments
The call to
If no (valid) license is found by our license scanning heuristics or the passed license is invalid we still start. The difference is in the word "provided" vs "present". Invoking You're asking that if there is no data we should ignore those calls. If there is not data the user should not invoke those methods: if (!string.IsNullOrEmpty(licenseText))
{
endpointConfiguration.License(licenseText);
} or if (!File.Exist(licensePath))
{
endpointConfiguration.LicensePath(licensePath);
} or if (!File.Exist(licensePath))
{
var licenseText = File.ReadAllText(licensePath);
if (!string.IsNullOrEmpty(licenseText))
{
endpointConfiguration.LicensePath(licensePath);
}
} The difference is more in an explicit configuration using @dbelcham Do you have more information as currently it seems that just ignoring an explicit decision by the user if not the right approach. |
We use the call to As such, we rely on NSB's licensing which allows us to run in any non-production environment without a full license. Our expectation is that we can have the exact same code in each of our environments (i.e. no conditional saying "use It seems like a very leaky abstraction that we need to add a conditional check for what our license value is when we retrieve it and then we have to decide how NSB should behave when the license is not available. This isn't our application's concern. This is an NSB concern that should be fully encapsulated with in the apis that NSB provides. |
We triaged this issue and concluded that this is not a bug. |
Describe the bug
Description
When using the
EndpointConfiguration.License(string)
method, providing a null, empty or whitespace string will thrown an exception which bubbles into the user's code that is starting the endpoint. Usually this will be an exception that surfaces in the application's startup code and it will cause the application to fail during startup unless there is specifictry...catch
code written to handle that exception.Since the longstanding principle of NSB has been to not prevent running of an endpoint if a license is not provided, this behaviour is both unexpected and contrary to that practice.
While this is not a critical bug, since there is a work around (provide a valid license string), we think it is a high level bug since it is a) not documented, and b) contrary to the behaviour that the framework exhibits elsewhere.
Expected behavior
I would expect that a null, empty or whitespace license string would behave like an endpoint that was configured, and started, with no license provided at all.
Actual behavior
Exception is thrown
Versions
Observed in NServiceBus 9.0.1
Steps to reproduce
Call
EndpointConfiguration.License("")
Relevant log output
Additional Information
Workarounds
Provide a license value that is not
""
,null
or whitespace.Possible solutions
Instead of throwing an exception, fall back to the behaviour that an endpoint exhibits when no license at all is provided.
Additional information
The text was updated successfully, but these errors were encountered: