Giter Site home page Giter Site logo

giorgi / efcore.visualizer Goto Github PK

View Code? Open in Web Editor NEW
385.0 7.0 6.0 1.74 MB

Entity Framework Core queries debugger visualizer.

Home Page: https://marketplace.visualstudio.com/items?itemName=GiorgiDalakishvili.EFCoreVisualizer

License: GNU General Public License v3.0

C# 53.51% HTML 6.19% CSS 40.31%
debugger-visualizer efcore postgersql query-plan sql-server visual-studio

efcore.visualizer's Introduction

EFCore.Visualizer

Entity Framework Core Query Plan Visualizer

View Entity Framework Core query plan directly inside Visual Studio.

Visual Studio Marketplace Version Visual Studio Marketplace Downloads Visual Studio Marketplace Rating

Introduction

With Entity Framework Core query plan debugger visualizer, you can view the query plan of your queries directly inside Visual Studio. Currently, the visualizer supports SQL Server and PostgreSQL.

Important

The visualizer requires Visual Studio Version 17.9.0 (Released on February 13th) or newer and supports EF Core 7 or newer.

Usage

After installing the extension from the marketplace, a new debugger visualizer will be added to Visual Studio. When debugging, hover over your queries and there will be an option to view the query plan:

VariableVisualizer

Click on 'Query Plan Visualizer' and the query plan will be displayed for your query.

SQL Server:

Sql Server Plan

Sql Server Plan

PostgreSQL:

PostgreSQL Plan

PostgreSQL Plan

Known Issues:

Credits

This extension uses pev2 and html-query-plan to display query plans.

efcore.visualizer's People

Contributors

erikej avatar giorgi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

efcore.visualizer's Issues

Unable to install

7/02/2024 9:37:27 - Extension is not signed.
7/02/2024 9:37:27 - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.
bij VSIXInstaller.ExtensionService.GetInstallableDataImpl(String vsixPath, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable1& skuData) bij VSIXInstaller.ExtensionService.GetInstallableData(String vsixPath, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable1& skuData)
bij VSIXInstaller.ExtensionPackService.IsExtensionPack(IStateData stateData, Boolean isRepairSupported)
bij VSIXInstaller.ExtensionPackService.ExpandExtensionPackToInstall(IStateData stateData, Boolean isRepairSupported)
bij VSIXInstaller.App.Initialize(Boolean isRepairSupported)
bij VSIXInstaller.App.Initialize()
bij System.Threading.Tasks.Task`1.InnerInvoke()
bij System.Threading.Tasks.Task.Execute()

View section does not appear.

I am using Visual Studio 17.9.0 and My Project has Microsoft.EntityFrameworkCore 8.0.1
Also installed the EFCore.Visualizer plugin. But the view section does not appear.

image

image

Error System.MissingMethodException thrown when trying to see the query plan of an IQueryable variable

Hello,
I was trying to use the extension with VS 2022, latest version 17.9.1, but I got this error:

Cannot evaluate expression since the function evaluation requires all threads to run.

image

Then I checked the logs in the Output window and found this:

System.MissingMethodException thrown when loading the VisualizerAssemblyLoadContext. Message: Cannot dynamically create an instance of type 'Microsoft.VisualStudio.NetCoreAssemblyResolution.VisualizerAssemblyLoadContext'. Reason: No parameterless constructor defined.

My IQueryable variable is something not too fancy, I'm working in a private code base so I can't post the actual tables, but it resembles something like this:

var postsQuery = dbContext.Posts
    .Where(x => x.DeletedDate == null && x.Blog.DeletedDate == null)
    .Where(x => x.Title == title && x.Blog.Name == blogName);

var posts = await postsQuery.ToListAsync();

The error happens when trying to see the query plan for the postsQuery variable.

My application is based on EF Core 8, .NET 8, Windows 11 Pro 23H2

What could be wrong?

Extension is not signed

Hello,

I couldn't find a way to install the extension. It can't be found in the marketplace, and a direct download and manual install doesn't work : Extension is not signed.

image

[Question] Publishing

Previously you were not allowed to publish extensions using the new extensibility SDK - has this restriction been lifted?

Unable to use query plan visualizer

When I move my mouse over the where condition, I cannot use the query plan expression. I must define a variable to work well, which will cause a lot of inconvenience in practical use

test

Install failed

Hi

I'm not able to install this extension.
Currently I have VS2019 and VS2022

image

Error when viewing query plan inside a transaction

I am using Visual Studio version 17.9.0
I tried uploading an image file, but Github would not accept it

Here is what I get when I try to use the query plan visualizer:

ExecuteNonQuery requires the command to have a transaction
when the connection assigned to the command is in
a pending local transaction. The transaction property of the
command has not been initialized.

Here is my query:

using IDbContextTransaction dbContextTransaction = _mainRepositoryWrapperService
    .DbContextService
    .Database
    .BeginTransaction();
try
{
    IQueryable<TableReport> q = _mainRepositoryWrapperService
        .TableReport
        .FindByCondition(f => f.ID == 989);

Not installable

I've the latest VS Pro 2022 and the installer says
"This extension is not installable on any currently installed products."

Full log:

13.02.2024 07:53:45 - Microsoft VSIX Installer
13.02.2024 07:53:45 - -------------------------------------------
13.02.2024 07:53:45 - vsixinstaller.exe version:
13.02.2024 07:53:45 - 17.8.2368+6fbeaa1954
13.02.2024 07:53:45 - -------------------------------------------
13.02.2024 07:53:45 - Command line parameters:
13.02.2024 07:53:45 - C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXInstaller.exe,C:\Users\dtw\Downloads\EFCore.Visualizer.vsix
13.02.2024 07:53:45 - -------------------------------------------
13.02.2024 07:53:45 - Microsoft VSIX Installer
13.02.2024 07:53:45 - -------------------------------------------
13.02.2024 07:53:45 - Initializing Install...
13.02.2024 07:53:45 - Searching for applicable products...
13.02.2024 07:53:45 - Found installed product - Visual Studio Professional 2019
13.02.2024 07:53:45 - Found installed product - Visual Studio Professional 2022
13.02.2024 07:53:45 - Found installed product - Global Location
13.02.2024 07:53:45 - Extension Details...
13.02.2024 07:53:45 - 	Identifier         : EFCore.Visualizer.a059bff0-3edd-4b37-921b-f93d93161013
13.02.2024 07:53:45 - 	Name               : EFCore.Visualizer
13.02.2024 07:53:45 - 	Author             : Giorgi Dalakishvili
13.02.2024 07:53:45 - 	Version            : 1.0.2
13.02.2024 07:53:45 - 	Description        : View Entity Framework Core query plan directly inside Visual Studio.
13.02.2024 07:53:45 - 	Locale             : en-US
13.02.2024 07:53:45 - 	MoreInfoURL        : https://github.com/Giorgi/EFCore.Visualizer
13.02.2024 07:53:45 - 	InstalledByMSI     : False
13.02.2024 07:53:45 - 	SupportedFrameworkVersionRange : [4.5,)
13.02.2024 07:53:45 - 	SignatureState     : Unsigned
13.02.2024 07:53:45 - 	Supported Products : 
13.02.2024 07:53:45 - 		Microsoft.VisualStudio.Community
13.02.2024 07:53:45 - 			Version : [17.9,18.0)
13.02.2024 07:53:45 - 			ProductArchitecture : amd64
13.02.2024 07:53:45 - 		Microsoft.VisualStudio.Community
13.02.2024 07:53:45 - 			Version : [17.9,18.0)
13.02.2024 07:53:45 - 			ProductArchitecture : arm64
13.02.2024 07:53:45 - 		Microsoft.VisualStudio.Pro
13.02.2024 07:53:45 - 			Version : [17.9,18.0)
13.02.2024 07:53:45 - 			ProductArchitecture : amd64
13.02.2024 07:53:45 - 		Microsoft.VisualStudio.Pro
13.02.2024 07:53:45 - 			Version : [17.9,18.0)
13.02.2024 07:53:45 - 			ProductArchitecture : arm64
13.02.2024 07:53:45 - 		Microsoft.VisualStudio.Enterprise
13.02.2024 07:53:45 - 			Version : [17.9,18.0)
13.02.2024 07:53:45 - 			ProductArchitecture : amd64
13.02.2024 07:53:45 - 		Microsoft.VisualStudio.Enterprise
13.02.2024 07:53:45 - 			Version : [17.9,18.0)
13.02.2024 07:53:45 - 			ProductArchitecture : arm64
13.02.2024 07:53:45 - 	References         : 
13.02.2024 07:53:45 - 	Prerequisites      : 
13.02.2024 07:53:45 - 		-------------------------------------------------------
13.02.2024 07:53:45 - 		Identifier   : Microsoft.VisualStudio.Component.CoreEditor
13.02.2024 07:53:45 - 		Name         : Visual Studio core editor
13.02.2024 07:53:45 - 		Version      : [17.0,18.0)
13.02.2024 07:53:45 - Signature Details...
13.02.2024 07:53:45 - 	Extension is not signed.
13.02.2024 07:53:46 - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.
   at VSIXInstaller.ExtensionService.GetInstallableDataImpl(String vsixPath, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable`1& skuData)
   at VSIXInstaller.ExtensionService.GetInstallableData(String vsixPath, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable`1& skuData)
   at VSIXInstaller.ExtensionPackService.IsExtensionPack(IStateData stateData, Boolean isRepairSupported)
   at VSIXInstaller.ExtensionPackService.ExpandExtensionPackToInstall(IStateData stateData, Boolean isRepairSupported)
   at VSIXInstaller.App.Initialize(Boolean isRepairSupported)
   at VSIXInstaller.App.Initialize()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

Additional "Works with" targets

Hi Giorgi, this extension looks great from the description! I think it will be super useful. I'd love to give it a go, but it won't install in my Visual Studio 2022 instance. I suspect it's because it only targets AMD and ARM processors (I've got an Intel processor). Is there a limitation there, or can additional targets be added so I can install it? Thanks in advance!

image

Clarification Question

        var blog = sqlServerDb.Blogs
            .OrderBy(b => b.BlogId)
            .First();

vs

        var query= sqlServerDb.Blogs
            .OrderBy(b => b.BlogId);

        var blog = query.First();

The latter one shows the visualizer - this is the expected behavior, correct? (query must be separate from projection)

Actual plan

I see you are using the actual plan, causing SQL Server to actually execute your query - is that deliberate?

(Sometimes executing a query can have side effects) - I see you do the same for Postgres

Could not load file or assembly Newtonsoft.Json

I am getting the following error while trying to view the query plan (immediately after clicking on View).

Could not load file or assembly 'Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. Could not find or load a specific file. (0x80131621)

VS version is Version 17.9.0. EF Core version is 8.0.0. Any other relevant info I can provide to help resolve the issue?

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.