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

GetCustomSupportedTypes throws NullReferenceException #52

Open
aldrashan opened this issue Jun 26, 2019 · 0 comments
Open

GetCustomSupportedTypes throws NullReferenceException #52

aldrashan opened this issue Jun 26, 2019 · 0 comments

Comments

@aldrashan
Copy link

GetCustomSupportedTypes (ExpressionBuilder.Helpers.OperationHelper) throws NullReferenceException when you don't have the config section defined in your project.

foreach (var supportedType in _settings.SupportedTypes) { if (supportedType.Type != null) { TypeGroups[supportedType.TypeGroup].Add(supportedType.Type); } }

This foreach loop throws an exception since _settings.SupportedTypes is null.

Suggested change:
In ExpressionBuilder.Configuration.Settings class, LoadSettings method:

var configSection = ConfigurationManager.GetSection(ExpressionBuilderConfig.SectionName) as ExpressionBuilderConfig; if (configSection == null) {settings.SupportedTypes = new List(); return; }

I've added the part in bold. This seems to fix the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant