question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NET Core 3 Preview 7 AddJsonFile Throws MissingMethodException

See original GitHub issue

System.MissingMethodException HResult=0x80131513 Message=Method not found: ‘System.Text.Json.JsonDocument System.Text.Json.JsonDocument.Parse(System.String, System.Text.Json.JsonReaderOptions)’. Source=Microsoft.Extensions.Configuration.FileExtensions StackTrace: at Microsoft.Extensions.Configuration.FileConfigurationProvider.HandleException(Exception e) at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload) at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load() at Microsoft.Extensions.Configuration.ConfigurationRoot…ctor(IList`1 providers) at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()…

To Reproduce

Steps to reproduce the behavior:

  1. Using “Microsoft.Extensions.Configuration.Json” Version=“3.0.0-preview7.19362.4”
  2. Run this code return new ConfigurationBuilder() .SetBasePath(outputPath) .AddJsonFile(“appsettings.json”, true, true) .AddEnvironmentVariables() .Build();
  3. See exception.

Expected behavior

No Exception and Configuration File Loaded and Ready

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
dhhuntercommented, Jul 25, 2019

Upon further investigation I realized that the problem was not affecting new projects, only those projects that I had upgraded to Preview 7 from Preview 6. So after beating my head against a wall for a couple of hours today trying to figure out what was going on, I ended up adding a NuGet reference to:

Microsoft.Extensions.Configuration.Json Version=“3.0.0-preview7.19362.4”

In my MS Test Project and it finally worked. It must have been linking against an old version of the assembly that was not showing up in Visual Studio.

Thanks and my sincere apologies for the rushed bug report!

1reaction
losdamianoscommented, Aug 8, 2019

I just ran into the exact same issue when I was trying to read appsettings.json on the recently updated project from older preview version .net core to preview 7 after updating Microsoft.Extensions.Configuration.Json to the latest preview everything worked fine

Read more comments on GitHub >

github_iconTop Results From Across the Web

ConfigureLogging MissingMethodException with 2.0.0 ...
I have 3 projects in my solution; my application and two class libraries. In my class libraries, I have references to a couple...
Read more >
ASP.NET Core updates in .NET 8 Preview 7
NET 8 Preview 3 has been updated to use the new C# 12 interceptors compiler feature to support intercepting calls to minimal API's...
Read more >
JsonConfigurationExtensions.AddJsonFile Method
Adds a JSON configuration source to builder.
Read more >
Looking inside ConfigurationManager in .NET 6
In this post I take a look at the ConfigurationManager class new in .NET 6, explore why it was added, and look at...
Read more >
The Future of ASP.NET Core: A Preview of .NET 8 Features
NET Core from .NET 8 Preview 1 and Preview 2. 00:00 Introduction 00:28 Blazor United 01:38 QuickGrid for Blazor 02:56 Performance ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found