-
Notifications
You must be signed in to change notification settings - Fork 23
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
Exception when requesting the first view #29
Comments
Is your entire project going through OWIN, or are you running OWIN on top of the normal ASP.NET stack just for SignalR? I ask because you appear to have the normal Autofac MVC registration, as well as the OWIN registration. |
I'm using Owin only for SignalR. As far as I know the classic MVC5 cannot work on top of Owin, and requires the classic I know this is not a fortunate setup, however I could not find a better way back then. |
FYI I tried removing the OWIN-based two lines
The issue is still the same. |
Does the error still happen if you comment out the view page property injection?
|
Yes, that was the point. After commenting it out, everything seems to work fine at first glance. And also, it seems like those two lines in my previous comment are really not needed in this setup. |
I suspect you may still need the You shouldn't need the I still feel that there's something up here, adding the ViewRegistrationSource shouldn't cause everything to break like that. Do your Views derive from a custom type, or directly from |
I don't have anything special as far as I can tell. This is my
|
Ok, thanks; I wonder if there may actually be a defect with the ViewRegistrationSource, in that it doesn't support Do you have a recreating project you can upload? |
Just to update; I've had a go at re-creating this issue myself, but I can't get the error you're seeing when you have the ViewRegistrationSource in place. If you are able to provide a sample project that would be great, because I still feel like there's something going on here; until then though I'm going to park this. |
Sorry for the delay. Unfortunately I don't have too much time for creating a repro project. However, I can try to reduce this project and remove all private information to reproduce the issue. Give me a few days to prepare it. |
Thanks @cervengoc, I appreciate the effort. |
Do you by any chance use builder.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource()) I just ran into the same problem you described when migrating from Unity to Autofac and enabling AnyConcreteTypeNotAlreadyRegisteredSource |
@lars-nielsen Yes indeed I do use this special source. Unfortunately I still don't have the time to prepare a repro project, so I hope this additional information can help investigating the issue. |
It's been a little over two years and we don't have a repro here. Given the limited time of the owners team to address core Autofac and all the integration libraries, without a repro we won't be able to pursue this. I'm going to close the issue and if a repro becomes available we can investigate. |
Hi all! I'm two years late to the party, but I wanted to chime in since I also had this issue and found an appropriate workaround for it. Like some of the others here, I was migrating an MVC project from Unity to Autofac, and needed to use While I don't fully understand the mechanisms involved here, it looks like the cause is that MVC is, for some reason, trying to use Autofac to resolve dependencies in some internal framework code. The workaround here is to provide a predicate that prevents Autofac from trying to resolve these objects: _builder.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource(type => !type.IsInNamespace("System")));
// Alternatively, you can check to see if types *do* belong to your project's namespace--for us, this wasn't an option due to legacy spaghetti. |
Hi,
In the past few days I've migrated an existing MVC5+Owin+SignalR (latest) web application to use latest Autofac and the integration libraries.
After solving the first few issues, I get the following exception which I'm unable to sort out.
I'm registering everything using the sample code from the docs.
And I have some setup code using some of my custom solutions.
Also, I have some ASP.NET SignalR hubs which require me to use Owin, and I'm trying to use Autofac there too.
I have a quite strong feeling that I'm mixing a few concepts but I cannot wrap my head around all these stuff and make them work together nicely.
Could anyone provide me some hints or tips what I should check?
The text was updated successfully, but these errors were encountered: