Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Add dependency on System.Runtime.Serialization.Primitives to make up for JSON.NET not including it #3946

Closed
davidfowl opened this issue Jan 17, 2016 · 5 comments
Assignees
Milestone

Comments

@davidfowl
Copy link
Member

When running MVC without explicitly adding System.Runtime.Serialization.Primitives when running on the .NET CLI you'll get this error:

An unhandled exception has occurred while executing the request
      System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.Serialization.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

      File name: 'System.Runtime.Serialization.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
         at Microsoft.AspNet.Mvc.Formatters.Json.Internal.MvcJsonMvcOptionsSetup.<>c__DisplayClass0_0.<.ctor>b__0(MvcOptions options)
         at Microsoft.Extensions.Options.OptionsCache`1.CreateOptions()
         at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory)
         at Microsoft.AspNet.Mvc.ApplicationModels.DefaultApplicationModelProvider..ctor(IOptions`1 mvcOptionsAccessor)
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite.Invoke(ServiceProvider provider)
         at Microsoft.Extensions.DependencyInjection.ServiceProvider.TransientCallSite.Invoke(ServiceProvider provider)
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.ClosedIEnumerableService.CallSite.Invoke(ServiceProvider provider)
         at Microsoft.Extensions.DependencyInjection.ServiceProvider.TransientCallSite.Invoke(ServiceProvider provider)
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite.Invoke(ServiceProvider provider)
         at Microsoft.Extensions.DependencyInjection.ServiceProvider.TransientCallSite.Invoke(ServiceProvider provider)
         at Microsoft.Extensions.DependencyInjection.ServiceLookup.ClosedIEnumerableService.CallSite.Invoke(ServiceProvider provider)
         at Microsoft.Extensions.DependencyInjection.ServiceProvider.TransientCallSite.Invoke(ServiceProvider provider)
         at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
         at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService[T](IServiceProvider provider)
         at Microsoft.AspNet.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.GetCollection()
         at Microsoft.AspNet.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.get_ActionDescriptors()
         at Microsoft.AspNet.Mvc.Routing.AttributeRoute.GetTreeRouter()
         at Microsoft.AspNet.Mvc.Routing.AttributeRoute.RouteAsync(RouteContext context)
         at Microsoft.AspNet.Routing.RouteCollection.<RouteAsync>d__9.MoveNext()
      --- 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 Microsoft.AspNet.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()
      --- 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 Microsoft.AspNet.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext()

It's because of JamesNK/Newtonsoft.Json#618. DNX used to include this assembly so it wasn't needed but now it is. Until we sorta out netstandard and the process for building new style libraries we should add it as a dependency to MVC.Core.

/cc @pranavkm @rynowak

@davidfowl davidfowl added the bug label Jan 17, 2016
@davidfowl davidfowl added this to the 6.0.0-rc2 milestone Jan 17, 2016
@pranavkm
Copy link
Contributor

I'll address this as part of #3908 (although I haven't run this as yet).

@davidfowl
Copy link
Member Author

@pranavkm Try running HelloMvc (https://github.com/davidfowl/dotnetcli-aspnet5/tree/master/HelloMvc) after removing that package from project.json

@davidfowl
Copy link
Member Author

So it looks like we're going to need XDocument as well:

FileNotFoundException: Could not load file or assembly 'System.Xml.XDocument, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

It's all JSON.NET. Hopefully it'll all go away once we're netstandard and JSON.NET is updated to have dependencies listed.

/cc @JamesNK

@JamesNK
Copy link
Member

JamesNK commented Feb 1, 2016

When you release RC2 and the tools are there, I'll release a version with netstandard 😁

@davidfowl
Copy link
Member Author

Sure I'm just looking at what's blowing up right now

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants