Cause This isn't an error in and of itself, but more of a feature of your debugger. Some properties require code to be executed so that the property can be read, but if this requires cross-thread interaction, then other threads may have to run as well. The debugger doesn't do this automatically, but certainly can,... Continue Reading →
MetadataException: Unable to load the specified metadata resource
Causes This means that the application is unable to load the EDMX. Your connection string might be wrong. you might not have changed it, but if you have changed other things (say, the name of an assembly), it could still be wrong. You might be using a post-compile task to embed the EDMX in the... Continue Reading →
Object reference not set to an instance of the object
Solution This exception occurs when you try to insert null value into a not null column in DB e.g in primary key column or any other not null column. Insert the value in that column and the issue will be resolved 🙂
StoredProcedureName_Result not found
Solution If your stored procedure i returning just a column or more than 1 columns and not returning the ID column that is the primary key, this error would occur. Just include ID or * in select statement e.g. ALTER PROCEDURE [dbo].[sp_FillMenuItems] AS BEGIN SELECT * from t_Menu End OR ALTER PROCEDURE [dbo].[sp_FillMenuItems] AS BEGIN... Continue Reading →
System.Data.Entity.Core.EntityCommandExecutionException
Solution This error occurs when for example, there is a mismatch e.g. in a model or database column name. Ensure that the names of the parameters given in C# (where the call to procedure is given) match with those in the procedure(in database)
There is no ViewData item of type ‘IEnumerable’ that has the key ‘DropDownList’.
Solution In Controller ViewData["DropDownList"] = clsChargesCollection.FillInstallments().Select(x => new SelectListItem { Text = x.Description, Value = x.ID.ToString() }).ToList(); Syntax ViewData["name to be given"]=db.MethodName.Select(object => new SelectListItem{Text = object.columnName, Value = object.columnName.ToString()}.ToList(); In View: Try to access the variable within the top of your View where titles are given @{ List <SelectListItem> MemIds = ViewData["DropDownlist"] as List<SelectListItem>;... Continue Reading →
System.Web.HttpException: The following sections have been defined but have not been rendered for the layout page “~/Views/Shared/_Layout.cshtml”: “Scripts”.
Solution The exception occurs if you have defined a section in your master Layout.cshtml, but you have not included anything for that section in your View. If your _Layout.cshtml has something like this: @RenderSection("scripts") Then all your Views that use that Layout must include a @section with the same name (even if the contents of the section are... Continue Reading →
Metadata file dll could not be found
Solution If there is no such file on the path that is mentioned in the error, then it is just because the build of the problematic project is failed. Just comment all the lines of code that are causing error(s) and build the project again. The error will be gone.
Class is inaccessible due to its protection level
Cause As it already states that class is inaccessible due to its protection level, it means that the protection level of the constructor or class is not public due to which it cannot be accessed by any other class. Therefore, you need to make it public so it can be accessed by other classes. Sometimes... Continue Reading →