Assembly.Location and Assembly.CodeBase are very similar, but not the same thing. To reduce confusion, we should mark it as obsolete.
Reason
Having two things that are similar, but not identical always causes confusion. Here is an example.
As @jkotas said:
Assembly.Location is strictly better than Assembly.CodeBase.
Assembly.CodeBase is an obsolete property. The only reason why it was included in .NET Core was .NET Framework compatibility. The original purpose of Assembly.CodeBase was CAS (Code Access Security). It was meant to describe where the assembly was downloaded from for the Internet Zone security checks. It also explains some of its weird behaviors. For example, if the assembly is loaded as byte array, it returns the location of the caller of the Assembly.Load method.
Proposed API
namespace System.Reflection
{
public partial class Assembly
{
[Obsolete("Use Location instead.")]
public virtual string CodeBase { get; }
}
}
Assembly.LocationandAssembly.CodeBaseare very similar, but not the same thing. To reduce confusion, we should mark it as obsolete.Reason
Having two things that are similar, but not identical always causes confusion. Here is an example.
As @jkotas said:
Proposed API