New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASP.NET 4: EF Core gets the wrong version of System.Collections.Immutable when Microsoft.CodeDom.Providers.DotNetCompilerPlatform is installed #6220

Closed
mafshin opened this Issue Aug 1, 2016 · 10 comments

Comments

Projects
None yet
4 participants
@mafshin

mafshin commented Aug 1, 2016

Steps to reproduce

  • Create a ASP.NET 4.6 Web API project
  • Create a data library project with EF Core
  • Add a code reference to the data library and access the context. This will force you to install Microsoft.EntityFrameworCore along with its dependencies
    e.g
    BookContext context = new BookContext(); await context.Database.EnsureCreatedAsync();

The issue

EF Core require System.Collections.Immutable 1.2 while the version installed by Web API is older.

If you try to uninstall EF Core and System.Collections.Immutable in WebAPI and reinstall it again via Nuget, the version of System.Collections.Immutable that installs will be 1.1.36.0 instead of 1.2.
The version that is listed in packages.config is 1.2 while the one that will be installed is 1.1.36.0

I observed same kind of exception for System.Interactive.Async library.

Exception message:

Could not load file or assembly 'System.Collections.Immutable, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Stack trace:

[FileLoadException: Could not load file or assembly 'System.Collections.Immutable, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
   Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.RelationshipDiscoveryConvention.Apply(InternalEntityTypeBuilder entityTypeBuilder) +0
   Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.ConventionDispatcher.OnEntityTypeAdded(InternalEntityTypeBuilder entityTypeBuilder) +102
   Microsoft.EntityFrameworkCore.Metadata.Internal.Model.AddEntityType(EntityType entityType, Boolean runConventions) +123
   Microsoft.EntityFrameworkCore.Metadata.Internal.Model.AddEntityType(Type type, ConfigurationSource configurationSource, Boolean runConventions) +80
   Microsoft.EntityFrameworkCore.Metadata.Internal.InternalModelBuilder.Entity(Type type, ConfigurationSource configurationSource, Boolean runConventions) +115
   Microsoft.EntityFrameworkCore.ModelBuilder.Entity(Type type) +68
   Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.FindSets(ModelBuilder modelBuilder, DbContext context) +92
   Microsoft.EntityFrameworkCore.Infrastructure.Internal.RelationalModelSource.FindSets(ModelBuilder modelBuilder, DbContext context) +42
   Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator) +148
   Microsoft.EntityFrameworkCore.Infrastructure.<>c__DisplayClass14_0.<GetModel>b__0(Object k) +28
   System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +62
   Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.GetModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator) +130
   Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel() +134
   Microsoft.EntityFrameworkCore.Internal.LazyRef`1.get_Value() +17
   Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model() +45
   Microsoft.EntityFrameworkCore.Infrastructure.<>c.<AddEntityFramework>b__0_4(IServiceProvider p) +22
   Microsoft.Extensions.DependencyInjection.ServiceLookup.FactoryService.Invoke(ServiceProvider provider) +13
   Microsoft.Extensions.DependencyInjection.ScopedCallSite.Invoke(ServiceProvider provider) +92
   Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite.Invoke(ServiceProvider provider) +87
   Microsoft.Extensions.DependencyInjection.ScopedCallSite.Invoke(ServiceProvider provider) +92
   Microsoft.Extensions.DependencyInjection.<>c__DisplayClass12_0.<RealizeService>b__0(ServiceProvider provider) +86
   Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType) +64
   Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) +56
   Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider) +60
   Microsoft.EntityFrameworkCore.Storage.DatabaseProviderServices.GetService() +56
   Microsoft.EntityFrameworkCore.Storage.Internal.SqliteDatabaseProviderServices.get_Creator() +26
   Microsoft.EntityFrameworkCore.Infrastructure.<>c.<AddEntityFramework>b__0_11(IServiceProvider p) +30
   Microsoft.Extensions.DependencyInjection.ServiceLookup.FactoryService.Invoke(ServiceProvider provider) +13
   Microsoft.Extensions.DependencyInjection.ScopedCallSite.Invoke(ServiceProvider provider) +92
   Microsoft.Extensions.DependencyInjection.<>c__DisplayClass12_0.<RealizeService>b__0(ServiceProvider provider) +86
   Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType) +64
   Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService(IServiceProvider provider) +60
   Microsoft.EntityFrameworkCore.Infrastructure.AccessorExtensions.GetService(IInfrastructure`1 accessor) +77
   Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.EnsureCreatedAsync(CancellationToken cancellationToken) +13
   WebApplication1.Controllers.<Index>d__0.MoveNext() in C:\Users\UserA\Documents\Visual Studio 2015\Projects\AsyncAssemblyLoadException\WebApplication1\WebApplication1\Controllers\HomeController.cs:19
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) +97
   System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeAsynchronousActionMethod>b__36(IAsyncResult asyncResult) +17
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +50
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225
   System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +26
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +100
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +13
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +36
   System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +12
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +22
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +21
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9644037
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Further technical details

EF Core version: 1.0.0
Operating system: Windows 10 x64
Visual Studio version: 2015 Update 3

@divega divega added this to the 1.1.0 milestone Aug 2, 2016

@natemcmaster

This comment has been minimized.

Show comment
Hide comment
@natemcmaster

natemcmaster Aug 2, 2016

Member

@mafshin this error is symptomatic of incorrect assembly bindings. Can you share the section of your web.config file that contains binding redirects? This will be under the configuration > runtime > assemblyBindings. NuGet tooling should automatically generate these correctly, but they can still get mixed up.

Member

natemcmaster commented Aug 2, 2016

@mafshin this error is symptomatic of incorrect assembly bindings. Can you share the section of your web.config file that contains binding redirects? This will be under the configuration > runtime > assemblyBindings. NuGet tooling should automatically generate these correctly, but they can still get mixed up.

@mafshin

This comment has been minimized.

Show comment
Hide comment
@mafshin

mafshin Aug 3, 2016


    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
        <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.1.36.0" newVersion="1.1.36.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Remotion.Linq" publicKeyToken="fee00910d6e5f53b" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
      </dependentAssembly>
    </assemblyBinding>

mafshin commented Aug 3, 2016


    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
        <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.1.36.0" newVersion="1.1.36.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Remotion.Linq" publicKeyToken="fee00910d6e5f53b" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
      </dependentAssembly>
    </assemblyBinding>
@natemcmaster

This comment has been minimized.

Show comment
Hide comment
@natemcmaster

natemcmaster Aug 3, 2016

Member

I confirmed this is an issue with NuGet and opened NuGet/Home#3274.

The workaround is to manually update your binding redirects in web.config to the versions EF Core needs. (i.e. System.Collections.Immutable should be 1.2.0.0).

Member

natemcmaster commented Aug 3, 2016

I confirmed this is an issue with NuGet and opened NuGet/Home#3274.

The workaround is to manually update your binding redirects in web.config to the versions EF Core needs. (i.e. System.Collections.Immutable should be 1.2.0.0).

@mafshin

This comment has been minimized.

Show comment
Hide comment
@mafshin

mafshin Aug 5, 2016

@natemcmaster I was unable to fix the issue by replacing the following line
<bindingRedirect oldVersion="0.0.0.0-1.1.36.0" newVersion="1.1.36.0" />

by

<bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0" />

the above change will result in the following exception:

Could not load file or assembly 'System.Collections.Immutable' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I see that the 1.1.36.0 version comes from the following path, is that

C:\Users\XXX\documents\visual studio 2015\Projects\ConsoleApplication1\packages\Microsoft.Net.Compilers.1.0.0\build\..\tools\System.Collections.Immutable.dll

Which belongs to Microsoft.Net.Compilers.1.0.0, is that OK?

I even can't add a manual reference to 1.2 version directly from its package dll.

mafshin commented Aug 5, 2016

@natemcmaster I was unable to fix the issue by replacing the following line
<bindingRedirect oldVersion="0.0.0.0-1.1.36.0" newVersion="1.1.36.0" />

by

<bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0" />

the above change will result in the following exception:

Could not load file or assembly 'System.Collections.Immutable' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I see that the 1.1.36.0 version comes from the following path, is that

C:\Users\XXX\documents\visual studio 2015\Projects\ConsoleApplication1\packages\Microsoft.Net.Compilers.1.0.0\build\..\tools\System.Collections.Immutable.dll

Which belongs to Microsoft.Net.Compilers.1.0.0, is that OK?

I even can't add a manual reference to 1.2 version directly from its package dll.

@natemcmaster

This comment has been minimized.

Show comment
Hide comment
@natemcmaster

natemcmaster Aug 5, 2016

Member

You're likely seeing this because you are still getting System.Collections.Immutable 1.1.36.0 in your bin output. If that's the case, you have two options:

(1) Redirect new versions back to the actual version you have. <bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.1.36.0" />

(2) Set "SpecificVersion=true" for System.Collections.Immutable 1.2.0.0. NuGet generates this as "SpecificVersion=false" by default because of dotnet/roslyn#12255

<Reference Include="System.Collections.Immutable, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <SpecificVersion>True</SpecificVersion> <!--  nuget installation defaults to "false" -->
      <HintPath>..\packages\System.Collections.Immutable.1.2.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
      <Private>True</Private>
</Reference>

When specificversion is false, you can end up with v1.1.36.0 instead of 1.2.

Member

natemcmaster commented Aug 5, 2016

You're likely seeing this because you are still getting System.Collections.Immutable 1.1.36.0 in your bin output. If that's the case, you have two options:

(1) Redirect new versions back to the actual version you have. <bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.1.36.0" />

(2) Set "SpecificVersion=true" for System.Collections.Immutable 1.2.0.0. NuGet generates this as "SpecificVersion=false" by default because of dotnet/roslyn#12255

<Reference Include="System.Collections.Immutable, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <SpecificVersion>True</SpecificVersion> <!--  nuget installation defaults to "false" -->
      <HintPath>..\packages\System.Collections.Immutable.1.2.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
      <Private>True</Private>
</Reference>

When specificversion is false, you can end up with v1.1.36.0 instead of 1.2.

@natemcmaster natemcmaster changed the title from FileLoadException for System.Collections.Immutable & System.Interactive.Async dependency in csproj full framework to ASP.NET 4: Installing EF Core after Microsoft.Net.Compilers is installed produces incorrect csproj and binding redirects Aug 5, 2016

@natemcmaster natemcmaster changed the title from ASP.NET 4: Installing EF Core after Microsoft.Net.Compilers is installed produces incorrect csproj and binding redirects to ASP.NET 4: Installing EF Core when Microsoft.CodeDom.Providers.DotNetCompilerPlatform is already installed produces incorrect csproj and binding redirects Aug 5, 2016

@mafshin

This comment has been minimized.

Show comment
Hide comment
@mafshin

mafshin Aug 5, 2016

I can confirm the first solution worked but the second one didn't help. Thank you @natemcmaster

mafshin commented Aug 5, 2016

I can confirm the first solution worked but the second one didn't help. Thank you @natemcmaster

@natemcmaster natemcmaster changed the title from ASP.NET 4: Installing EF Core when Microsoft.CodeDom.Providers.DotNetCompilerPlatform is already installed produces incorrect csproj and binding redirects to ASP.NET 4: EF Core gets the wrong version of System.Collections.Immutable when Microsoft.Net.Compilers is installed Aug 5, 2016

@natemcmaster

This comment has been minimized.

Show comment
Hide comment
@natemcmaster

natemcmaster Aug 18, 2016

Member

I'm closed as there isn't anything actionable for EF. The roslyn team is working on a fix for dotnet/roslyn#12255. When that is available, this bug will be solved by updating the Microsoft.CodeDom.Providers.DotNetCompilerPlatform package.

Until that patch is available, the binding-redirect solution is the simplest workaround.

<dependentAssembly>
    <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.1.36.0" />
</dependentAssembly>
Member

natemcmaster commented Aug 18, 2016

I'm closed as there isn't anything actionable for EF. The roslyn team is working on a fix for dotnet/roslyn#12255. When that is available, this bug will be solved by updating the Microsoft.CodeDom.Providers.DotNetCompilerPlatform package.

Until that patch is available, the binding-redirect solution is the simplest workaround.

<dependentAssembly>
    <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.1.36.0" />
</dependentAssembly>
@jemiller0

This comment has been minimized.

Show comment
Hide comment
@jemiller0

jemiller0 Aug 19, 2016

I ran into the same problem. The markup listed above fixed the problem, only I had to update the new version to .37. Thanks for the help.
<dependentAssembly> <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.1.37.0" /> </dependentAssembly>

jemiller0 commented Aug 19, 2016

I ran into the same problem. The markup listed above fixed the problem, only I had to update the new version to .37. Thanks for the help.
<dependentAssembly> <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.1.37.0" /> </dependentAssembly>

@natemcmaster natemcmaster changed the title from ASP.NET 4: EF Core gets the wrong version of System.Collections.Immutable when Microsoft.Net.Compilers is installed to ASP.NET 4: EF Core gets the wrong version of System.Collections.Immutable when Microsoft.CodeDom.Providers.DotNetCompilerPlatform is installed Aug 19, 2016

@natemcmaster

This comment has been minimized.

Show comment
Hide comment
@natemcmaster

natemcmaster Sep 20, 2016

Member

FYI the fix for this is available now in Microsoft.CodeDom.Providers.DotNetCompilerPlatform 1.0.2.

http://www.nuget.org/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/

Member

natemcmaster commented Sep 20, 2016

FYI the fix for this is available now in Microsoft.CodeDom.Providers.DotNetCompilerPlatform 1.0.2.

http://www.nuget.org/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/

@mafshin

This comment has been minimized.

Show comment
Hide comment
@mafshin

mafshin Oct 7, 2016

@natemcmaster I installed DotNetCompilerPlatform1.0.2 and removed the immutable entry from packages config and reinstalled it via Nuget Package Manager, but still I get the 1.1.36.0 instead of 1.2.0.0

So, I have no choice except using the bindingRedirectworkaround even with DotNetCompilerPlatform 1.0.2

Since the path to the old version ...\packages\Microsoft.Net.Compilers.1.0.0\build\..\tools\System.Collections.Immutable.dll resides in Microsoft.Net.Compilers.1.0.0 I guess only installing new compiler via the following command was not effective:

Install-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform

mafshin commented Oct 7, 2016

@natemcmaster I installed DotNetCompilerPlatform1.0.2 and removed the immutable entry from packages config and reinstalled it via Nuget Package Manager, but still I get the 1.1.36.0 instead of 1.2.0.0

So, I have no choice except using the bindingRedirectworkaround even with DotNetCompilerPlatform 1.0.2

Since the path to the old version ...\packages\Microsoft.Net.Compilers.1.0.0\build\..\tools\System.Collections.Immutable.dll resides in Microsoft.Net.Compilers.1.0.0 I guess only installing new compiler via the following command was not effective:

Install-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment