.NET 4.7.1 app referencing fields .NET standard 2.0 can cause missing field exception from select assemblies
See original GitHub issueFound in D15Rel 27110.0 1.Create a .NET 4.7.1 C# console app and a ,NET Standard 2.0 class library. 2. Inside the Class Library add the following field/constructor to the class.
public System.Net.Http.StringContent StringContent;
public Class1()
{
StringContent = new System.Net.Http.StringContent("asdf");
}
- Add a reference from the class library to the console app.
- Add some code to reference StringContent in the Main method of the console app such as:
Class1 c= new Class1();
c.StringContent.GetType();
- Start debugging
Expected: Application builds fine and runs fine.
Actual: Application breaks during execution. Following is found in the output: An unhandled exception of type ‘System.MissingFieldException’ occurred in Unknown Module. Field not found: ‘ClassLibrary1.Class1.StringContent’.
This also occurs with System.IO.Compression.ZipArchive
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
You must add a reference to assembly 'netstandard ...
NET Core SDK 2.0 and .NET Framework 4.7.1 installed in my machine but I don't want to include a reference to it. This...
Read more >Add a reference to assembly netstandard error with .NET ...
A .NET Framework 4.6.1 project which has a reference to a nuget package built with .netstandard2.0 is no more building.
Read more >Migrate from .NET Framework to .NET Core (.NET 6)
In this article, we will learn about the things you should consider and focus on while migrating your existing applications from .NET ......
Read more >C# 11 and . NET 7 - Modern Cross-Platform Development ...
NET Standard • 16 .NET platforms and tools used by the C# and .NET book editions • 17. Topics covered by Apps and...
Read more >MySQL Connector/NET Developer Guide
This manual describes how to install and configure MySQL Connector/NET, the connector that enables .NET applications to communicate with MySQL servers, and how ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@livarcocc yeah he meant it the other way around, and also, this problem will be fixed in VS 15.6 Preview 3. What is happening here is that we don’t automatically create a binding redirect to System.Net.Http on the apps config, after adding it manually the but doesn’t repro anymore:
@livarcocc this is the fix that we took in for VS 15.6 preview 3 a few weeks ago by updating the support package that will be inserted.
@mattscheffer and @joperezr thanks for replying.
Given that we have the fix in already and 15.6 preview3 is out the door, I am going to close this issue.
@mattscheffer if this still reproes with 15.6 Preview3, just comment and we can re-activate and continue investigating.