diff --git a/src/System.Private.CoreLib/Resources/Strings.resx b/src/System.Private.CoreLib/Resources/Strings.resx index 851b914347e5..6966bb37b8bb 100644 --- a/src/System.Private.CoreLib/Resources/Strings.resx +++ b/src/System.Private.CoreLib/Resources/Strings.resx @@ -797,7 +797,7 @@ The value "{0}" is not of type "{1}" and cannot be used in this generic collection. - Absolute path information is required. + Path "{0}" is not an absolute path. An item with the same key has already been added. diff --git a/src/System.Private.CoreLib/shared/System/Reflection/Assembly.cs b/src/System.Private.CoreLib/shared/System/Reflection/Assembly.cs index a841c828c931..db7d10abfd92 100644 --- a/src/System.Private.CoreLib/shared/System/Reflection/Assembly.cs +++ b/src/System.Private.CoreLib/shared/System/Reflection/Assembly.cs @@ -217,7 +217,7 @@ public static Assembly LoadFile(string path) if (PathInternal.IsPartiallyQualified(path)) { - throw new ArgumentException(SR.Argument_AbsolutePathRequired, nameof(path)); + throw new ArgumentException(SR.Format(SR.Argument_AbsolutePathRequired, path), nameof(path)); } string normalizedPath = Path.GetFullPath(path); diff --git a/src/System.Private.CoreLib/shared/System/Runtime/Loader/AssemblyLoadContext.cs b/src/System.Private.CoreLib/shared/System/Runtime/Loader/AssemblyLoadContext.cs index c9d0c16b7ef4..39b533516f3b 100644 --- a/src/System.Private.CoreLib/shared/System/Runtime/Loader/AssemblyLoadContext.cs +++ b/src/System.Private.CoreLib/shared/System/Runtime/Loader/AssemblyLoadContext.cs @@ -299,7 +299,7 @@ public Assembly LoadFromAssemblyPath(string assemblyPath) if (PathInternal.IsPartiallyQualified(assemblyPath)) { - throw new ArgumentException(SR.Argument_AbsolutePathRequired, nameof(assemblyPath)); + throw new ArgumentException(SR.Format(SR.Argument_AbsolutePathRequired, assemblyPath), nameof(assemblyPath)); } lock (_unloadLock) @@ -319,12 +319,12 @@ public Assembly LoadFromNativeImagePath(string nativeImagePath, string? assembly if (PathInternal.IsPartiallyQualified(nativeImagePath)) { - throw new ArgumentException(SR.Argument_AbsolutePathRequired, nameof(nativeImagePath)); + throw new ArgumentException(SR.Format(SR.Argument_AbsolutePathRequired, nativeImagePath), nameof(nativeImagePath)); } if (assemblyPath != null && PathInternal.IsPartiallyQualified(assemblyPath)) { - throw new ArgumentException(SR.Argument_AbsolutePathRequired, nameof(assemblyPath)); + throw new ArgumentException(SR.Format(SR.Argument_AbsolutePathRequired, assemblyPath), nameof(assemblyPath)); } lock (_unloadLock) @@ -394,7 +394,7 @@ protected IntPtr LoadUnmanagedDllFromPath(string unmanagedDllPath) if (PathInternal.IsPartiallyQualified(unmanagedDllPath)) { - throw new ArgumentException(SR.Argument_AbsolutePathRequired, nameof(unmanagedDllPath)); + throw new ArgumentException(SR.Format(SR.Argument_AbsolutePathRequired, unmanagedDllPath), nameof(unmanagedDllPath)); } return NativeLibrary.Load(unmanagedDllPath);