Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Edited Issue: InvalidOperationException now that MARS is off by default [979]

$
0
0
Hi

I recently upgraded to EF6 alpha 3 and I started receiving an exception when running my integration tests.

It took me a while to track it down, but I believe it is caused by the changeset [22ed3cab3f43](http://entityframework.codeplex.com/SourceControl/changeset/22ed3cab3f43) which changed MARS to be off by default.

I'm receiving an exception when making two asynchronous requests using the new asyc support in EF6. Below is the stack trace

```
System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.InvalidOperationException: The connection does not support MultipleActiveResultSets.
at System.Data.SqlClient.SqlCommand.<ExecuteDbDataReaderAsync>b__24(Task`1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.<ExecuteStoreCommandsAsync>d__c.MoveNext()
--- End of inner exception stack trace ---
at Machine.Specifications.TaskSpecificationExtensions.Await[T](Task`1 task)
```

I can very easily get past the issue by enabling MARS explicitly, (below is the app.config of the integration test project), but the reason I'm raising this is that if async requires MARS, is it correct to have it disabled by default.

FYI app.config to fix the issue

``` xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
<parameter value="Integrated Security=True;MultipleActiveResultSets=True" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
</configuration>
```

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>