efcore icon indicating copy to clipboard operation
efcore copied to clipboard

Cannot debug dotnet ef dbcontext scaffold

Open zsvanderlaan opened this issue 9 years ago • 4 comments

I am trying to debug my application as it is being invoked by entity framework dbscaffold, but do not get debugging symbols loaded for my code.

My project looks like this:

image

I have these dependencies: image

My csproj file looks like this: image

When I attempt to run the scaffold command: dotnet ef dbcontext scaffold <connection_string_here> Microsoft.EntityFrameworkCore.SqlServer --data-annotations --force --context BaseDatabaseContext --output-dir .\Models

I expect that because I have Debugger.Launch() that when my debugger attaches I will be able to see the breakpoint I have set and step through. Unfortunately I do not.

image

Further, if I continue (pressing the continue button) I get the following error which crashes the process:

image

Most Importantly, please help me understand why I am getting an source not available error. Secondly, how do i prevent the application from crashing so i can step through? I am hoping to implement my own EntityTypeWriter by registering it in the ConfigureDesignTimeServices method configuration hook, but if I can't step through and see what value's I have to work with it won't do me much good.

Thanks!

zsvanderlaan avatar Mar 25 '17 00:03 zsvanderlaan

@Eilon Is there a general issue somewhere on GitHib that tracks making symbols available for our packages?

ajcvickers avatar Mar 27 '17 19:03 ajcvickers

Symbol publishing is tracked here: https://github.com/aspnet/Coherence/issues/124

Eilon avatar Mar 28 '17 16:03 Eilon

@zsvanderlaan We are working on being able to get symbols published as part of the wider ASP.NET Core and ,NET Core projects. This is being tracked for us by the issue @Eilon referenced above.

With regard to the crash, does it happen only when debugging, or also when you run the code outside of the debugger?

ajcvickers avatar Mar 28 '17 16:03 ajcvickers

I believe the error was caused within my implementation of CustomCandidateNamingService and not dotnetcore.

I look forward to seeing symbol support in the future, this process would have been much simpler.

For the time being i found a workaround by using the -v flag on my scaffold command and used console.Write for output based debugging.

Thanks for the response

zsvanderlaan avatar Mar 29 '17 17:03 zsvanderlaan