1

I'm getting an unexpected error when I (re)build the main project of my solution:

"Exception has been thrown by the target of an invocation." D:\MyApp\Db\Model.edmx

Db is a supporting project referenced by the main project. I created the .EDMX with a Model-First design.

I've looked at the detailed build output, but nothing is apparent as to what the cause and/or source of this is. There's no apparent way to find out what the exception actually is.

Nor does Google return anything for this error in the context of an .EDMX file.

How to go about finding out what's causing this, so I can fix it?

EDIT #1: I also get the error as a single MessageBox when I try to open the .EDMX for editing in Visual Studio. There's no hint about what the exception may be, nor where I might find more detail.

EDIT #2: I've been able to narrow it down to one of these four assemblies:

  • Db.dll (the project assembly)
  • EntityFramework.dll
  • EntityFramework.SqIServer.dll
  • EntityFramework.SqIServerCompact.dll

If I delete any one of the four in the project's \bin folder, I can open the .EDMX for editing.

Does anyone know how to trap the exception that's occurring, so I can go about fixing it?

InteXX
  • 6,135
  • 6
  • 43
  • 80
  • It really would help to have the full exception and stack trace. You might also want to try some of the suggestions in this SO post: http://stackoverflow.com/questions/18440304/entity-framework-code-migrations-exception-has-been-thrown-by-the-target-of-an – Special Sauce Jun 17 '15 at 02:50
  • @SpecialSauce - That's just it... there's no exception detail nor stack trace anywhere I can find. It's certainly not in the build output, which I've set to Detailed in Tools\Settings. If I knew what the exception was in the first place, I'd be 99% of the way there in solving it. VS doesn't seem to want to give up this info. – InteXX Jun 17 '15 at 02:53
  • Maybe you want to try [this](http://stackoverflow.com/questions/5823691/exception-has-been-thrown-by-the-target-of-an-invocation-when-building-a-visu) or [that](https://social.msdn.microsoft.com/Forums/vstudio/en-US/4cdb0f42-5d83-4ac9-9cab-d5cc093e2d66/exception-has-been-thrown-by-the-target-of-an-invocation-when-building-a-visual-studio-2010?forum=vsx) – TobiMcNamobi Jun 17 '15 at 07:27
  • @TobiMcNamobi - Thanks for the lead. Deleting the bin/obj folders helps, but it doesn't last past the first build. – InteXX Jun 17 '15 at 21:34

1 Answers1

0

I found the source of the exception—it's the SqlServerCe provider (or its configuration) that's installed by SQL Server CE & SQLite ToolBox. When I change the provider to SqlClient the exception disappears.

This is not impugn this excellent tool—there just appears to be a conflict between its latest version and VS2013.4.

EDIT:

I'm pleased to be able to retract my report; the problem didn't lie within the extension's scope.

The problem was that I hadn't installed the EF Tools for Visual Studio nor registered the DDEX provider. Details here.

InteXX
  • 6,135
  • 6
  • 43
  • 80