I\'ve installed Visual Studio 2013 and when I run my app I get the error below.
I\'ve got no idea as to where I\'m to initialized this object.
What to do?
I began getting this error one day. After I'd altered our app to call EnsureInitialized()
I was able to see the root cause.
I had a custom attribute, a filter, on an action. That attribute class had had a breaking change made in the NuGet package in which it lives.
Even though I'd updated the the code and it all compiled, the local IIS worker was loading an old DLL and not finding a class member during initialization, reading attributes on actions etc.
For some reason (possibly due to order/when our logging is initialized), this error was not discoverable, possibly leaving the WebAPI in a strange state, until I'd added EnsureInitialized()
which caught the exception and surfaced it.
Performing a proper bin
and obj
clean via a handy script resolved it.
In my case , i used an Entity as parameter of my action that its 'Schema' is missing.
Wrong attribute:
[Table("Table name", Schema = "")]
Correct :
[Table("Table name", Schema = "schema name")]