I want to get access to the m_Info field of Uri class to change some fields inside. but uriInfo.GetValue(uri) returns null.
var uri = new Uri("https://stackoverflow.com/questions/12993962/set-value-of-private-field");
var uriInfo = typeof(Uri).GetField("m_Info", BindingFlags.NonPublic | BindingFlags.Instance);
var infoField = uriInfo.GetValue(uri);
the code works fine for my test class with the same structure as Uri but it fails for the System.Uri class. Any ideas?