Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

services.AddDatabaseDeveloperPageExceptionFilter(); error code: CS1061

i'm coding like below

   public void ConfigureServices(IServiceCollection services)
    {
        services.AddDbContext<SchoolContext>(options => 
             options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
        services.AddDatabaseDeveloperPageExceptionFilter();
        services.AddControllersWithViews();
    }

but i got a error message

Error CS1061 'IServiceCollection' does not contain a definition for 'AddDatabaseDeveloperPageExceptionFilter' and no accessible extension method 'AddDatabaseDeveloperPageExceptionFilter' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)
AspCore_DB C:\Startup.cs 30 Active

this code is officially introduced in the MS guide and i just followed. i'm working on MS Visual studio 2019 v16.8.2

like image 241
BoBo Avatar asked Nov 25 '20 14:11

BoBo


People also ask

What is cs1061 error in Salesforce?

This error occurs when you try to call a method or access a class member that does not exist. The following example generates CS1061 because Person does not have a DisplayName method. It does have a method that is called WriteSomething. Perhaps that is what the author of this source code meant to write.

Does adddatabasedeveloperpageexceptionfilter exist in the iservicecollection?

The definition for AddDatabaseDeveloperPageExceptionFilter does not exist in the IServiceCollection. Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking. Sorry, something went wrong. Sign up for free to join this conversation on GitHub .

What is Compt compiler error cs1061?

Compiler Error CS1061. 'type' does not contain a definition for 'member' and no extension method 'name' accepting a first argument of type 'type' could be found (are you missing a using directive or an assembly reference?). This error occurs when you try to call a method or access a class member that does not exist.

Why does this generate cs1061?

The following example generates CS1061 because Persondoes not have a DisplayNamemethod. It does have a method that is called WriteName. Perhaps that is what the author of this source code meant to write. public class Person { private string _name; public Person(string name) => _name = name; // Person has one method, called WriteName.


Video Answer


1 Answers

After doing some research I found that this is in the Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore library.

like image 130
Dennis Kiesel Avatar answered Oct 19 '22 01:10

Dennis Kiesel