The code that worked in ef core 1.1.0 no longer working in 1.1.1 and there is no way to use version 1.1.0 in VS 2017
Exception message:
An exception occurred in the database while iterating the results of a query.
Stack trace:
System.InvalidOperationException: No value provided for required parameter ''_outer_Value''.
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.CreateCommand(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<ExecuteAsync>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable.AsyncEnumerator.<BufferlessMoveNext>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.<ExecuteAsync>d__6`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable.AsyncEnumerator.<MoveNext>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.SelectAsyncEnumerable`2.SelectAsyncEnumerator.<MoveNext>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.SelectAsyncEnumerable`2.SelectAsyncEnumerator.<MoveNext>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.<MoveNext>d__5.MoveNext()
System.InvalidOperationException: No value provided for required parameter ''_outer_Value''.
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.CreateCommand(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<ExecuteAsync>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable.AsyncEnumerator.<BufferlessMoveNext>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.<ExecuteAsync>d__6`2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable.AsyncEnumerator.<MoveNext>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.SelectAsyncEnumerable`2.SelectAsyncEnumerator.<MoveNext>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.SelectAsyncEnumerable`2.SelectAsyncEnumerator.<MoveNext>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.<MoveNext>d__5.MoveNext()',@p5=N'GET',@p6=N'Microsoft.EntityFrameworkCore.Query.Internal.SqlServerQueryCompilationContextFactory
I have follwoign code (see issue #7776)
c#
from user in context.Users
let info= context.LastInfo.OrderByDescending(t => t.CreatedDate).FirstOrDefault(t => t.UserId== user.Id)
let extra = context.Extras.OrderByDescending(t => t.CreatedDate).FirstOrDefault(s => s.UserId == user.Id)
select new UserExtraInfo
{
Active = user.Active,
Id = user.Id,
LastInfoDate = info.CreatedDate,
LastTest1 = extra.Test1,
LastTest2 = extra.Test2,
LastTest3 = extra.Test3,
InfoTest1= info.Test1,
InfoTest1= info.Test2
};
EF Core version: 1.1.1
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10
IDE: Visual Studio 2017
@msmolka We are investigating this issue, but I just wanted to note that you can use EF Core 1.1.0 with VS2017. If you are installing into a new project, then you can just use that version of the packages. If you upgraded to the new version it should still be possible to downgrade, although you may have to do some manual editing of the csproj file.
@msmolka Before this gets fixed you should be able to use 1.1.0 version with VS 2017. Following is configuration I've been using for a few weeks in RC and now due to this bug in RTM.
NetStandardImplicitPackageVersion is required
<PropertyGroup>
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0-msbuild3-final" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.0" />
</ItemGroup>
In case it helps, duplicate issue #7799 now contains the following self-contained repro provided by @axelheer:
```c#
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.SqlClient;
using System.Linq;
using Microsoft.EntityFrameworkCore;
// --- Models ------------------------------------------------------------------
public class Parent
{
[Key]
public Guid Id { get; set; }
[Required]
public string Name { get; set; }
public ISet<Child> Children { get; } = new HashSet<Child>();
}
public class Child
{
[Key]
public Guid Id { get; set; }
[Required]
public string Name { get; set; }
[Required]
public Guid? ParentId { get; set; }
public Parent Parent { get; set; }
}
// -- ViewModels ---------------------------------------------------------------
public class ResultView
{
public string Name { get; set; }
public int Children { get; set; }
}
// --- Context -----------------------------------------------------------------
public class ModelContext : DbContext
{
public DbSet
public DbSet<Child> Children { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
var connectionStringBuilder = new SqlConnectionStringBuilder()
{
DataSource = "(localdb)\\MSSQLLocalDB",
InitialCatalog = "EFCore",
IntegratedSecurity = true
};
optionsBuilder.UseSqlServer(connectionStringBuilder.ConnectionString);
}
}
// --- Test --------------------------------------------------------------------
public class Program
{
public static void Main(string[] args)
{
// Set up database
using (var context = new ModelContext())
{
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
}
// Create query
using (var context = new ModelContext())
{
var query = from parent in context.Parents
select new ResultView
{
Name = parent.Name,
Children = parent.Children.Count
};
query.ToList();
}
}
}
```
@maumar - Check if this is fixed.
dupe of #7714
Most helpful comment
In case it helps, duplicate issue #7799 now contains the following self-contained repro provided by @axelheer:
```c#
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.SqlClient;
using System.Linq;
using Microsoft.EntityFrameworkCore;
// --- Models ------------------------------------------------------------------
public class Parent
{
[Key]
public Guid Id { get; set; }
}
public class Child
{
[Key]
public Guid Id { get; set; }
}
// -- ViewModels ---------------------------------------------------------------
public class ResultView
{
public string Name { get; set; }
}
// --- Context -----------------------------------------------------------------
public class ModelContext : DbContext Parents { get; set; }
{
public DbSet
}
// --- Test --------------------------------------------------------------------
public class Program
{
public static void Main(string[] args)
{
// Set up database
using (var context = new ModelContext())
{
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
}
}
```