Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Mismatches for parameter names between reference and implementation assembly #19763

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

Closed
Anipik opened this issue Jul 30, 2020 · 0 comments · Fixed by #20193
Closed

Mismatches for parameter names between reference and implementation assembly #19763

Anipik opened this issue Jul 30, 2020 · 0 comments · Fixed by #20193
Assignees
Labels
breaking-change Indicates a .NET Core breaking change 🏁 Release: .NET 5 Work items for the .NET 5 release

Comments

@Anipik
Copy link
Contributor

Anipik commented Jul 30, 2020

There are mismatches between argument names of some of the the apis between the ref assembly and the implementation assembly. This could cause problems while using named arguments and reflection.

Version introduced

These mismatches were present when these new apis were introduced.

Old behavior

namespace System.CodeDom.Compiler
{
    public abstract class CodeGenerator : ICodeGenerator
    {
        protected void GenerateStatements(CodeStatementCollection stms) {}
    }
}

namespace System.Diagnostics
{
    public class StackTrace
    {
        public StackFrame(bool fNeedFileInfo) { }
        public StackFrame(int skipFrames, bool fNeedFileInfo) { }
    }
}

namespace System.Net
{
    public class NetworkCredential : ICredentials, ICredentialsByHost
    {
        public NetworkCredential GetCredential(string host, int port, string authType){}
    }
    public class IPAddress
    {
        public static System.Net.IPAddress Parse(System.ReadOnlySpan<char> ipString) { throw null; }
        public static bool TryParse(ReadOnlySpan<char> ipString, out IPAddress address);
    }
}

namespace System
{
    public static class StringNormalizationExtensions
    {
        public static bool IsNormalized(this string value) {  }
        public static bool IsNormalized(this string value, System.Text.NormalizationForm normalizationForm) { }
        public static string Normalize(this string value) {  }
        public static string Normalize(this string value, System.Text.NormalizationForm normalizationForm) {  }
    }
}

namespace System.IO.IsolatedStorage
{
    public class IsolatedStorageFileStream : FileStream
    {
        public override IAsyncResult BeginRead(byte[] buffer, int offset, int numBytes, AsyncCallback userCallback, object stateObject);
       public override IAsyncResult BeginWrite(byte[] buffer, int offset, int numBytes, AsyncCallback userCallback, object stateObject);
    }
}
namespace System.ComponentModel
{
    public sealed class ParenthesizePropertyNameAttribute : Attribute
    {
        public override bool Equals(object o);
    }
    public sealed class RefreshPropertiesAttribute : Attribute
    {
        public override bool Equals(object value);
    }
}

namespace System.Drawing
{
    public sealed class Icon : MarshalByRefObject, ICloneable, IDisposable, ISerializable
    {
        void System.Runtime.Serialization.ISerializable.GetObjectData(SerializationInfo info, StreamingContext context);
    }
    public abstract class Image : MarshalByRefObject, ICloneable, IDisposable, ISerializable
    {
        void System.Runtime.Serialization.ISerializable.GetObjectData(SerializationInfo info, StreamingContext context);
    }
}

New behavior

namespace System.CodeDom.Compiler
{
    public abstract class CodeGenerator : ICodeGenerator
    {
        protected void GenerateStatements(CodeStatementCollection stmts) {}
    }
}

namespace System.Diagnostics
{
    public class StackTrace
    {
        public StackFrame(bool needFileInfo) { }
        public StackFrame(int skipFrames, bool needFileInfo) { }
    }
}

namespace System.Net
{
    public class NetworkCredential : ICredentials, ICredentialsByHost
    {
        public NetworkCredential GetCredential(string host, int port, string authenticationType){ }
    }
    public class IPAddress
    {
        public static System.Net.IPAddress Parse(System.ReadOnlySpan<char> ipSpan) { }
        public static bool TryParse(ReadOnlySpan<char> ipSpan, out IPAddress address) { }
    }
}

namespace System
{
    public static class StringNormalizationExtensions
    {
        public static bool IsNormalized(this string strInput) {  }
        public static bool IsNormalized(this string strInput, System.Text.NormalizationForm normalizationForm) { }
        public static string Normalize(this string strInput) {  }
        public static string Normalize(this string strInput, System.Text.NormalizationForm normalizationForm) { }
    }
}

namespace System.IO.IsolatedStorage
{
    public class IsolatedStorageFileStream : FileStream
    {
        public override IAsyncResult BeginRead(byte[] array, int offset, int numBytes, AsyncCallback userCallback, object stateObject);
       public override IAsyncResult BeginWrite(byte[] array, int offset, int numBytes, AsyncCallback userCallback, object stateObject);
    }
}

namespace System.ComponentModel
{
    public sealed class ParenthesizePropertyNameAttribute : Attribute
    {
        public override bool Equals(object obj);
    }
    public sealed class RefreshPropertiesAttribute : Attribute
    {
        public override bool Equals(object obj);
    }
}

namespace System.Drawing
{
    public sealed class Icon : MarshalByRefObject, ICloneable, IDisposable, ISerializable
    {
        void System.Runtime.Serialization.ISerializable.GetObjectData(SerializationInfo si, StreamingContext context);
    }
    public abstract class Image : MarshalByRefObject, ICloneable, IDisposable, ISerializable
    {
        void System.Runtime.Serialization.ISerializable.GetObjectData(SerializationInfo si, StreamingContext context);
    }
}

Reason for change

  • Consistency.
  • Avoid failures while using named arguments and reflection.

Recommended action

There could be a compile error which could be easily resolved by changing the argument name.

Category

  • Core .NET libraries

Affected APIs

cc @ericstj
PR dotnet/runtime#39741


Issue metadata

  • Issue type: breaking-change
@dotnet-bot dotnet-bot added ⌚ Not Triaged Not triaged breaking-change Indicates a .NET Core breaking change labels Jul 30, 2020
@gewarren gewarren self-assigned this Jul 30, 2020
@gewarren gewarren added doc-idea and removed ⌚ Not Triaged Not triaged labels Jul 30, 2020
@gewarren gewarren added the 🏁 Release: .NET 5 Work items for the .NET 5 release label Aug 19, 2020
gewarren added a commit to gewarren/docs that referenced this issue Aug 19, 2020
gewarren added a commit that referenced this issue Aug 20, 2020
* add binaryformatter bc to asp.net category too

* Fixes #19763
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Indicates a .NET Core breaking change 🏁 Release: .NET 5 Work items for the .NET 5 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants