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

Ensure ApplicationContext isn't null during initialization #4615

Open
rockfordlhotka opened this issue Mar 28, 2025 · 2 comments
Open

Ensure ApplicationContext isn't null during initialization #4615

rockfordlhotka opened this issue Mar 28, 2025 · 2 comments
Assignees

Comments

@rockfordlhotka
Copy link
Member

As business base types are instantiated, the ApplicationContext is set via the IUseApplicationContext interface.

Within the implementations of that interface, we should ensure that the provided ApplicationContext value is not null. If it is null, that leads to other bugs that are hard to debug, and it would be better to just throw an exception right away to indicate that the app environment isn't set up right, or that the business class isn't being created correctly.

@StefanOssendorf
Copy link
Contributor

There should be already exceptions when trying to set the context to null.

@rockfordlhotka
Copy link
Member Author

At least in CSLA 9 there certainly are cases (in the unit tests) where the context is set to null.

Maybe this has been resolved by your NRT changes in CSLA 10. My changes in v9 here throw an exception if the value is null during the IUseApplicationContext implementations.

@rockfordlhotka rockfordlhotka moved this to In Progress in CSLA Version 9.1.0 Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: In Progress
Development

No branches or pull requests

2 participants