Difference between revisions of "EF Core error"

From Logic Wiki
Jump to: navigation, search
(Created page with "Category:EntityFramework Category:MVC Couldn't find the solution for these <pre> Add-Migration : Exception calling "Substring" with "1" argument(s): "StartIndex can...")
 
Line 2: Line 2:
 
[[Category:MVC]]
 
[[Category:MVC]]
  
−
 
+
== Problem ==
−
Couldn't find the solution for these
+
When I run Add-Migration or update-database commands in PM I get these errors.
−
 
+
 
<pre>
 
<pre>
 
Add-Migration : Exception calling "Substring" with "1" argument(s): "StartIndex cannot be less than zero.
 
Add-Migration : Exception calling "Substring" with "1" argument(s): "StartIndex cannot be less than zero.
Line 14: Line 13:
 
     + FullyQualifiedErrorId : ArgumentOutOfRangeException,Add-Migration
 
     + FullyQualifiedErrorId : ArgumentOutOfRangeException,Add-Migration
 
</pre>
 
</pre>
 +
 +
== Explanation ==
 +
When the project structured like
 +
* .NET CORE
 +
* MySql (SapientGuardian)
 +
* StructureMap
 +
Structuremap obviously try to auto fill an interface in a constructor in MySql EF code ..
 +
 +
It works and does the job but it also displays this error.

Revision as of 13:50, 4 April 2017


Problem

When I run Add-Migration or update-database commands in PM I get these errors.

Add-Migration : Exception calling "Substring" with "1" argument(s): "StartIndex cannot be less than zero.
Parameter name: startIndex"
At line:1 char:1
+ Add-Migration -Name 'Firstqa' -verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-Migration], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentOutOfRangeException,Add-Migration

Explanation

When the project structured like

  • .NET CORE
  • MySql (SapientGuardian)
  • StructureMap

Structuremap obviously try to auto fill an interface in a constructor in MySql EF code ..

It works and does the job but it also displays this error.