Cause It uses an older debugging engine which causes the problem. In other words, it is caused when you compile a 32-bit assembly and try to use it from a 64-bit process. Solution Go to Tools > Option > Debugging -> General > un-check the "Use Managed Compatibility Mode".
The entity type ‘DisplayDetails’ requires a primary key to be defined. If you intended to use a keyless entity type, call ‘HasNoKey’ in ‘OnModelCreating’. For more information on keyless entity types, see https://go.microsoft.com/fwlink/?linkid=2141943.
Solution: If you intend to create a table without a primary key in the database just add [Keyless] before class name as follows: [Keyless] public class DisplayDetails { } You might come across the error when you add "keyless" that is because you also need to add this using statement: using Microsoft.EntityFrameworkCore;
The migration ‘20220222164040_CreateUserTable’ has already been applied to the database. Revert it and try again. If the migration has been applied to other databases, consider reverting its changes using a new migration instead.
The solution is simple. Just force to remove the migration by typing this command in the package manager console and the migration will be removed: Remove-Migration -Force
Moving a file from one folder to another in visual studio but it shows older project folder in ‘using’ statement
This issue occurs when we copy paste the entire code to the new file and we forget to change the name of namespace. After pasting the code to new file, change this line: namespace ProjectName.oldfolder to this one: namespace ProjectName.newfolder
Package ‘EntityFramework 6.2.0’ was restored using ‘.NETFramework,Version=v4.6.1’ instead of the project target framework ”
Check the .Net versions of all your projects in the solution explorer. In my case, it was .Net 6.0.1 in 2 projects and .Net 6.2.0 in the 3rd project so I changed the version of the third project and it worked. To do so: Right click the solution name in solution explorer.Select 'Manage Nuget Packages... Continue Reading →
Visual Studio during Debugging: The function evaluation requires all threads to run
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)