Skip to content

Commit 02b24f0

Browse files
authored
Merge pull request #79 from Lombiq/issue/OSOE-751
OSOE-751: Upgrade to Orchard Core 1.8
2 parents 2725742 + dd5b4b5 commit 02b24f0

File tree

6 files changed

+33
-28
lines changed

6 files changed

+33
-28
lines changed

Lombiq.Hosting.Azure.ApplicationInsights.Tests.UI/Lombiq.Hosting.Azure.ApplicationInsights.Tests.UI.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
</PropertyGroup>
66

77
<PropertyGroup>
@@ -28,8 +28,8 @@
2828
</ItemGroup>
2929

3030
<ItemGroup Condition="'$(NuGetBuild)' == 'true'">
31-
<PackageReference Include="Lombiq.Tests.UI" Version="8.2.1-alpha.1.osoe-733" />
32-
<PackageReference Include="Lombiq.Privacy.Tests.UI" Version="7.0.2-alpha.2.osoe-638" />
31+
<PackageReference Include="Lombiq.Tests.UI" Version="8.2.1-alpha.22.osoe-751" />
32+
<PackageReference Include="Lombiq.Privacy.Tests.UI" Version="7.0.3-alpha.1.osoe-751" />
3333
</ItemGroup>
3434

3535
</Project>

Lombiq.Hosting.Azure.ApplicationInsights/Lombiq.Hosting.Azure.ApplicationInsights.csproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
66
<DefaultItemExcludes>$(DefaultItemExcludes);.git*;node_modules\**;Tests\**</DefaultItemExcludes>
77
</PropertyGroup>
@@ -35,20 +35,20 @@
3535

3636
<ItemGroup>
3737
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
38-
<PackageReference Include="OrchardCore.Media.Azure" Version="1.7.0" />
39-
<PackageReference Include="OrchardCore.Module.Targets" Version="1.7.0" />
40-
<PackageReference Include="OrchardCore.ContentManagement" Version="1.7.0" />
41-
<PackageReference Include="OrchardCore.ContentTypes.Abstractions" Version="1.7.0" />
42-
<PackageReference Include="OrchardCore.DisplayManagement" Version="1.7.0" />
43-
<PackageReference Include="OrchardCore.ResourceManagement" Version="1.7.0" />
38+
<PackageReference Include="OrchardCore.Media.Azure" Version="1.8.2" />
39+
<PackageReference Include="OrchardCore.Module.Targets" Version="1.8.2" />
40+
<PackageReference Include="OrchardCore.ContentManagement" Version="1.8.2" />
41+
<PackageReference Include="OrchardCore.ContentTypes.Abstractions" Version="1.8.2" />
42+
<PackageReference Include="OrchardCore.DisplayManagement" Version="1.8.2" />
43+
<PackageReference Include="OrchardCore.ResourceManagement" Version="1.8.2" />
4444
</ItemGroup>
4545

4646
<ItemGroup Condition="'$(NuGetBuild)' != 'true'">
4747
<ProjectReference Include="..\..\..\Libraries\Lombiq.HelpfulLibraries\Lombiq.HelpfulLibraries.OrchardCore\Lombiq.HelpfulLibraries.OrchardCore.csproj" />
4848
</ItemGroup>
4949

5050
<ItemGroup Condition="'$(NuGetBuild)' == 'true'">
51-
<PackageReference Include="Lombiq.HelpfulLibraries.OrchardCore" Version="8.0.3-alpha.0.lmbq-249" />
51+
<PackageReference Include="Lombiq.HelpfulLibraries.OrchardCore" Version="8.1.1-alpha.7.osoe-751" />
5252
</ItemGroup>
5353

5454
</Project>

Lombiq.Hosting.Azure.ApplicationInsights/Services/AzureBlobTelemetryFilter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Lombiq.Hosting.Azure.ApplicationInsights.Extensions;
1+
using Lombiq.Hosting.Azure.ApplicationInsights.Extensions;
22
using Microsoft.ApplicationInsights.Channel;
33
using Microsoft.ApplicationInsights.DataContracts;
44
using Microsoft.ApplicationInsights.Extensibility;

Lombiq.Hosting.Azure.ApplicationInsights/Services/NullTelemetryChannel.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ internal sealed class NullTelemetryChannel : ITelemetryChannel
1111
public bool? DeveloperMode { get; set; }
1212
public string EndpointAddress { get; set; }
1313

14-
#pragma warning disable S1186 // Methods should not be empty
1514
public void Dispose() { }
1615
public void Flush() { }
1716
public void Send(ITelemetry item) { }
18-
#pragma warning restore S1186 // Methods should not be empty
1917
}

Lombiq.Hosting.Azure.ApplicationInsights/Services/TelemetryFilter.cs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,13 @@
1010

1111
namespace Lombiq.Hosting.Azure.ApplicationInsights.Services;
1212

13-
public class TelemetryFilter : ITelemetryProcessor
13+
public partial class TelemetryFilter : ITelemetryProcessor
1414
{
15-
private static readonly List<Regex> _expectedErrors = new()
16-
{
17-
// Using this generic error message to filter because it is not possible to filter only those cases where it is
18-
// meant to happen to throw this error. Also setting CreateContainer to false won't solve this issue, because
19-
// Blob Media container is always checked on each tenant activation in OrchardCore
20-
// MediaBlobContainerTenantEvents class.
21-
new(@"Azure\.RequestFailedException: The specified container already exists\.", RegexOptions.Compiled, TimeSpan.FromSeconds(1)),
22-
new(
23-
@"Microsoft\.Data\.SqlClient\.SqlException \(0x80131904\): There is already an object named '.*_Identifiers' in the database\.",
24-
RegexOptions.Compiled,
25-
TimeSpan.FromSeconds(1)),
26-
};
15+
private static readonly List<Regex> _expectedErrors =
16+
[
17+
AzureRequestFailedRegex(),
18+
ObjectAlreadyExistsRegex(),
19+
];
2720

2821
private readonly ITelemetryProcessor _next;
2922
private readonly IServiceProvider _serviceProvider;
@@ -99,4 +92,18 @@ private DependencyTelemetry GetDependencyTelemetryFailureToIgnore(ITelemetry ite
9992
// Name property value could be different depending on the environment, so using the Data property instead.
10093
return dependency.Data.Contains(mediaBlobStorageContainerName) ? dependency : null;
10194
}
95+
96+
// Using this generic error message to filter because it is not possible to filter only those cases where it is
97+
// meant to happen to throw this error. Also setting CreateContainer to false won't solve this issue, because
98+
// Blob Media container is always checked on each tenant activation in OrchardCore
99+
// MediaBlobContainerTenantEvents class.
100+
[GeneratedRegex(@"Azure\.RequestFailedException: The specified container already exists\.",
101+
RegexOptions.None,
102+
matchTimeoutMilliseconds: 1000)]
103+
private static partial Regex AzureRequestFailedRegex();
104+
105+
[GeneratedRegex(@"Microsoft\.Data\.SqlClient\.SqlException \(0x80131904\): There is already an object named '.*_Identifiers' in the database\.",
106+
RegexOptions.None,
107+
matchTimeoutMilliseconds: 1000)]
108+
private static partial Regex ObjectAlreadyExistsRegex();
102109
}

Lombiq.Hosting.Azure.ApplicationInsights/TelemetryInitializers/UserContextPopulatingTelemetryInitializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void Initialize(ITelemetry telemetry)
3939
if (options.EnableUserAgentCollection && string.IsNullOrEmpty(requestTelemetry.Context.User.UserAgent))
4040
{
4141
// While there is requestTelemetry.Context.User.UserAgent that's not displayed on the Azure Portal.
42-
requestTelemetry.TryAddProperty("UserAgent", httpContext.Request.Headers["User-Agent"]);
42+
requestTelemetry.TryAddProperty("UserAgent", httpContext.Request.Headers.UserAgent);
4343
}
4444

4545
if (options.EnableIpAddressCollection)

0 commit comments

Comments
 (0)