Skip to content

Commit 1e6f3e4

Browse files
mla-almcaptainsafia
authored andcommitted
Try using shared source
1 parent 3ff4caa commit 1e6f3e4

File tree

6 files changed

+19
-33
lines changed

6 files changed

+19
-33
lines changed

src/Logging.AzureAppServices/src/AzureFileLoggerOptions.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System;
5+
using Microsoft.AspNetCore.Shared;
56

67
namespace Microsoft.Extensions.Logging.AzureAppServices;
78

@@ -59,17 +60,8 @@ public string FileName
5960
get { return _fileName; }
6061
set
6162
{
62-
if (string.IsNullOrEmpty(value))
63-
{
64-
if (value is null)
65-
{
66-
throw new ArgumentNullException(nameof(value));
67-
}
68-
else
69-
{
70-
throw new ArgumentException("The value cannot be an empty string.", nameof(value));
71-
}
72-
}
63+
ArgumentThrowHelper.ThrowIfNullOrEmpty(value);
64+
7365
_fileName = value;
7466
}
7567
}

src/Logging.AzureAppServices/src/Microsoft.Extensions.Logging.AzureAppServices.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,10 @@
2828
<ItemGroup>
2929
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" Key="$(MoqPublicKey)" />
3030
</ItemGroup>
31+
32+
<ItemGroup>
33+
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentThrowHelper.cs" LinkBase="Shared" />
34+
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />
35+
</ItemGroup>
36+
3137
</Project>

src/SignalR/common/SignalR.Common/src/Microsoft.AspNetCore.SignalR.Common.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
<Compile Include="$(SignalRSharedSourceRoot)Utf8BufferTextReader.cs" Link="Internal\Utf8BufferTextReader.cs" />
1919
<Compile Include="$(SignalRSharedSourceRoot)Utf8BufferTextWriter.cs" Link="Internal\Utf8BufferTextWriter.cs" />
2020
<Compile Include="$(SignalRSharedSourceRoot)ReusableUtf8JsonWriter.cs" Link="Internal\ReusableUtf8JsonWriter.cs" />
21+
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentThrowHelper.cs" LinkBase="Shared" />
22+
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />
2123
</ItemGroup>
2224

2325
<ItemGroup>

src/SignalR/common/SignalR.Common/src/Protocol/HubMethodInvocationMessage.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.Linq;
6+
using Microsoft.AspNetCore.Shared;
67

78
namespace Microsoft.AspNetCore.SignalR.Protocol;
89

@@ -48,17 +49,7 @@ protected HubMethodInvocationMessage(string? invocationId, string target, object
4849
protected HubMethodInvocationMessage(string? invocationId, string target, object?[] arguments)
4950
: base(invocationId)
5051
{
51-
if (string.IsNullOrEmpty(target))
52-
{
53-
if (target is null)
54-
{
55-
throw new ArgumentNullException(nameof(target));
56-
}
57-
else
58-
{
59-
throw new ArgumentException("The value cannot be an empty string.", nameof(target));
60-
}
61-
}
52+
ArgumentThrowHelper.ThrowIfNullOrEmpty(target);
6253

6354
Target = target;
6455
Arguments = arguments;

src/SiteExtensions/Microsoft.Web.Xdt.Extensions/src/InsertOrAppendAttribute.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.Xml;
6+
using Microsoft.AspNetCore.Shared;
67
using Microsoft.Web.XmlTransform;
78

89
namespace Microsoft.Web.Xdt.Extensions;
@@ -44,17 +45,7 @@ protected string AttributeName
4445
/// <returns></returns>
4546
protected string GetArgumentValue(string name)
4647
{
47-
if (string.IsNullOrEmpty(name))
48-
{
49-
if (name is null)
50-
{
51-
throw new ArgumentNullException(nameof(name));
52-
}
53-
else
54-
{
55-
throw new ArgumentException("The value cannot be an empty string.", nameof(name));
56-
}
57-
}
48+
ArgumentThrowHelper.ThrowIfNullOrEmpty(name);
5849

5950
string result = null;
6051
if (Arguments != null && Arguments.Count > 0)

src/SiteExtensions/Microsoft.Web.Xdt.Extensions/src/Microsoft.Web.Xdt.Extensions.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@
1515
<PackageReference Include="Microsoft.Web.Xdt" Version="1.4.0" AllowExplicitReference="true" />
1616
</ItemGroup>
1717

18+
<ItemGroup>
19+
<Compile Include="$(SharedSourceRoot)ThrowHelpers\ArgumentThrowHelper.cs" LinkBase="Shared" />
20+
<Compile Include="$(SharedSourceRoot)CallerArgument\CallerArgumentExpressionAttribute.cs" LinkBase="Shared" />
21+
</ItemGroup>
1822
</Project>

0 commit comments

Comments
 (0)