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

Check the IsGenericParameter property before invoking the GetGenericParameterConstraints function #230

Merged
merged 1 commit into from May 2, 2016

Conversation

lazyWombat
Copy link

Hi

When working with the fluent interfaces the SimpleInjector throws annoying exceptions. It swallows them internally but it still looks bad (and also makes the debugging harder).

I've attached the simple class structure and the test that highlights the problem.

I'm not familiar with the simple injector code and I didn't find any good place for the GenericTypeBuilder tests so I placed the test into the RegisterOpenGenericTests file.

Cheers,
Demid

@dotnetjunkie dotnetjunkie merged commit 51f275a into simpleinjector:master May 2, 2016
@dotnetjunkie
Copy link
Collaborator

I merged this pull request, because it is a good improvement, but please note that in general you should configure the VS debugger in such way that you're not bothered with first-chance exceptions. Many frameworks and libraries (including the .NET framework itself) throws and swallows exceptions internally.

For Simple Injector it is even impossible to prevent causing any first-chance exception. Although we can improve things in this matter, Simple Injector sometimes depends on the CLRs type system to verify whether a type conforms to the given type constraints. And the only way to do this in .NET is by passing types to CreateGenericType and letting .NET throw an exception.

@dotnetjunkie dotnetjunkie added this to the v3.2 milestone May 2, 2016
@lazyWombat
Copy link
Author

Thanks for a quick response.

Yep, I know that but sometimes I really need to enable first-chance exceptions and in my case the other code throws exactly the same exception type. It was a small annoyance every time I restart the application and the fix was very simple.

I wish VS debugger will include modules filter some day so I can exclude certain modules from stopping the debugger (similar to the exception type filter we have now).

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

Successfully merging this pull request may close these issues.

None yet

2 participants