Skip to content

Commit 150dccb

Browse files
committed
Update nuget depencencies (#1218)
* Update nuget depencencies Notable changes * Changed from Microsoft.CodeAnalysis.Workspaces to Microsoft.CodeAnalysis.CSharp, in Inernal.Analyzers because of a compiller warning see: https://github.com/dotnet/roslyn-analyzers/blob/main/docs/rules/RS1038.md * Updated SDK reference in global.json * Updated Applicationinsights package and removed the test from #594 * Updated to released version of HybridCache and remove #pragma waring disable for preview * Used [CallerFilePath] intead of assemly location to find test data folder.
1 parent 426daf2 commit 150dccb

12 files changed

Lines changed: 56 additions & 87 deletions

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "8.0.405",
3+
"version": "8.0.407",
44
"rollForward": "latestFeature",
55
"allowPrerelease": false
66
}

src/Altinn.App.Api/Altinn.App.Api.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
<PackageReference Include="Altinn.Common.PEP" Version="4.1.2" />
1818
<PackageReference Include="Altinn.Platform.Storage.Interface" Version="4.0.4" />
1919
<PackageReference Include="Microsoft.FeatureManagement.AspNetCore" Version="4.0.0" />
20-
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.11.0" />
21-
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.11.0" />
22-
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.10.1" />
23-
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.10.0" />
24-
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.10.0" />
20+
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.11.2" />
21+
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.11.2" />
22+
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.11.1" />
23+
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.11.1" />
24+
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.11.1" />
2525
<PackageReference Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.3.0" />
2626
<PackageReference Include="Azure.Identity" Version="1.13.2" />
27-
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.3.2" />
27+
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.4.0" />
2828
</ItemGroup>
2929
<ItemGroup>
3030
<ProjectReference Include="..\Altinn.App.Core\Altinn.App.Core.csproj" />

src/Altinn.App.Core/Altinn.App.Core.csproj

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<FrameworkReference Include="Microsoft.AspNetCore.App" />
1212
</ItemGroup>
1313
<ItemGroup>
14-
<PackageReference Include="Altinn.ApiClients.Maskinporten" Version="8.0.1" />
14+
<PackageReference Include="Altinn.ApiClients.Maskinporten" Version="9.2.1" />
1515
<PackageReference Include="Altinn.Common.AccessTokenClient" Version="1.1.5" />
1616
<PackageReference Include="Altinn.Common.EFormidlingClient" Version="1.3.3" />
1717
<PackageReference Include="Altinn.Common.PEP" Version="4.1.2" />
@@ -20,18 +20,17 @@
2020
<PackageReference Include="JsonPatch.Net" Version="3.3.0" />
2121
<PackageReference Include="JWTCookieAuthentication" Version="3.0.1" />
2222
<!-- The following are depencencies for JWTCookieAuthentication, but we need newer versions-->
23-
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="8.3.1"
24-
/>
23+
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="8.7.0" />
2524
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.24" />
2625
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure" Version="3.3.19" />
2726
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
2827
<!-- End JWTCookieAuthentication deps -->
29-
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
30-
<PackageReference Include="Microsoft.Extensions.Caching.Hybrid" Version="[9.0.0-preview.9.24556.5]" NoWarn="NU5104" />
28+
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.23.0" />
29+
<PackageReference Include="Microsoft.Extensions.Caching.Hybrid" Version="9.3.0" />
3130
<PackageReference Include="Microsoft.FeatureManagement.AspNetCore" Version="4.0.0" />
3231
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
3332
<PackageReference Include="NetEscapades.EnumGenerators" Version="1.0.0-beta11" PrivateAssets="all" ExcludeAssets="runtime" />
34-
<PackageReference Include="OpenTelemetry.Api" Version="1.11.0" />
33+
<PackageReference Include="OpenTelemetry.Api" Version="1.11.2" />
3534
</ItemGroup>
3635

3736
<ItemGroup>

src/Altinn.App.Core/Extensions/ServiceCollectionExtensions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ IWebHostEnvironment env
107107
#pragma warning restore CS0618 // Type or member is obsolete
108108
services.AddHttpClient<IProcessClient, ProcessClient>();
109109
services.AddHttpClient<IPersonClient, PersonClient>();
110-
#pragma warning disable EXTEXP0018 // is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
111110
services.AddHybridCache();
112-
#pragma warning restore EXTEXP0018
113111

114112
services.TryAddTransient<IUserTokenProvider, UserTokenProvider>();
115113
services.TryAddTransient<IAccessTokenGenerator, AccessTokenGenerator>();

test/Altinn.App.Api.Tests/Altinn.App.Api.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
<PackageReference Include="FluentAssertions" Version="7.1.0" />
1212
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.12" />
1313
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="8.0.12" />
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
1515
<PackageReference Include="Moq" Version="4.20.72" />
16-
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
16+
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.0.0" />
1717
<PackageReference Include="xunit" Version="2.9.3" />
1818
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1">
1919
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

test/Altinn.App.Api.Tests/Data/TestData.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Runtime.CompilerServices;
12
using System.Text.Json;
23
using System.Text.Json.Serialization;
34
using Altinn.App.Core.Models;
@@ -16,12 +17,17 @@ public static class TestData
1617

1718
public static string GetTestDataRootDirectory()
1819
{
19-
var assemblyPath = new Uri(typeof(TestData).Assembly.Location).LocalPath;
20-
var assemblyFolder = Path.GetDirectoryName(assemblyPath);
21-
22-
return Path.Combine(assemblyFolder!, @"../../../Data/");
20+
var file = GetCallerFilePath();
21+
return (
22+
Path.GetDirectoryName(file)
23+
?? throw new DirectoryNotFoundException(
24+
$"Could not find directory for file {file}. Please check the test data root directory."
25+
)
26+
) + '/';
2327
}
2428

29+
private static string GetCallerFilePath([CallerFilePath] string file = "") => file;
30+
2531
public static string GetApplicationDirectory(string org, string app)
2632
{
2733
string testDataDirectory = GetTestDataRootDirectory();

test/Altinn.App.Api.Tests/OpenApi/OpenApiSpecChangeDetection.SaveJsonSwagger.verified.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
openapi: 3.0.1,
2+
openapi: 3.0.4,
33
info: {
44
title: Altinn App Api,
55
version: v1
@@ -1598,6 +1598,7 @@ If org and app does not match, this returns a 409 Conflict response,
15981598
name: queryParams,
15991599
in: query,
16001600
description: Query parameteres supplied,
1601+
style: deepObject,
16011602
schema: {
16021603
type: object,
16031604
additionalProperties: {
@@ -1677,6 +1678,7 @@ If org and app does not match, this returns a 409 Conflict response,
16771678
name: queryParams,
16781679
in: query,
16791680
description: Query parameters supplied,
1681+
style: deepObject,
16801682
schema: {
16811683
type: object,
16821684
additionalProperties: {
@@ -2072,6 +2074,7 @@ If org and app does not match, this returns a 409 Conflict response,
20722074
name: queryParams,
20732075
in: query,
20742076
description: The query parameters to pass to the external api endpoint,
2077+
style: deepObject,
20752078
schema: {
20762079
type: object,
20772080
additionalProperties: {
@@ -2934,6 +2937,7 @@ The body of the request isn't used for anything despite this being a POST operat
29342937
name: queryParams,
29352938
in: query,
29362939
description: Query parameters supplied,
2940+
style: deepObject,
29372941
schema: {
29382942
type: object,
29392943
additionalProperties: {
@@ -3039,6 +3043,7 @@ The body of the request isn't used for anything despite this being a POST operat
30393043
name: queryParams,
30403044
in: query,
30413045
description: Query parameteres supplied,
3046+
style: deepObject,
30423047
schema: {
30433048
type: object,
30443049
additionalProperties: {

test/Altinn.App.Api.Tests/OpenApi/swagger.json

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"openapi": "3.0.1",
2+
"openapi": "3.0.4",
33
"info": {
44
"title": "Altinn App Api",
55
"version": "v1"
@@ -223,7 +223,7 @@
223223
"tags": [
224224
"ApplicationMetadata"
225225
],
226-
"summary": "Get the application metadata https://altinncdn.no/schemas/json/application/application-metadata.schema.v1.json\r\n \r\nIf org and app does not match, this returns a 409 Conflict response",
226+
"summary": "Get the application metadata https://altinncdn.no/schemas/json/application/application-metadata.schema.v1.json\n \nIf org and app does not match, this returns a 409 Conflict response",
227227
"parameters": [
228228
{
229229
"name": "org",
@@ -282,7 +282,7 @@
282282
"tags": [
283283
"ApplicationMetadata"
284284
],
285-
"summary": "Get the application XACML policy file\r\n \r\nIf org and app does not match, this returns a 409 Conflict response",
285+
"summary": "Get the application XACML policy file\n \nIf org and app does not match, this returns a 409 Conflict response",
286286
"parameters": [
287287
{
288288
"name": "org",
@@ -342,7 +342,7 @@
342342
"tags": [
343343
"ApplicationMetadata"
344344
],
345-
"summary": "Get the application BPMN process file\r\n \r\nIf org and app does not match, this returns a 409 Conflict response",
345+
"summary": "Get the application BPMN process file\n \nIf org and app does not match, this returns a 409 Conflict response",
346346
"parameters": [
347347
{
348348
"name": "org",
@@ -1589,6 +1589,7 @@
15891589
"name": "queryParams",
15901590
"in": "query",
15911591
"description": "Query parameteres supplied",
1592+
"style": "deepObject",
15921593
"schema": {
15931594
"type": "object",
15941595
"additionalProperties": {
@@ -1668,6 +1669,7 @@
16681669
"name": "queryParams",
16691670
"in": "query",
16701671
"description": "Query parameters supplied",
1672+
"style": "deepObject",
16711673
"schema": {
16721674
"type": "object",
16731675
"additionalProperties": {
@@ -2063,6 +2065,7 @@
20632065
"name": "queryParams",
20642066
"in": "query",
20652067
"description": "The query parameters to pass to the external api endpoint",
2068+
"style": "deepObject",
20662069
"schema": {
20672070
"type": "object",
20682071
"additionalProperties": {
@@ -2404,7 +2407,7 @@
24042407
"tags": [
24052408
"Instances"
24062409
],
2407-
"summary": "Creates a new instance of an application in platform storage. Clients can send an instance as json or send a\r\nmultipart form-data with the instance in the first part named \"instance\" and the prefill data in the next parts, with\r\nnames that correspond to the element types defined in the application metadata.\r\nThe data elements are stored. Currently calculate and validate is not implemented.",
2410+
"summary": "Creates a new instance of an application in platform storage. Clients can send an instance as json or send a\nmultipart form-data with the instance in the first part named \"instance\" and the prefill data in the next parts, with\nnames that correspond to the element types defined in the application metadata.\nThe data elements are stored. Currently calculate and validate is not implemented.",
24082411
"parameters": [
24092412
{
24102413
"name": "org",
@@ -2542,7 +2545,7 @@
25422545
"Instances"
25432546
],
25442547
"summary": "Add complete confirmation.",
2545-
"description": "Add to an instance that a given stakeholder considers the instance as no longer needed by them. The stakeholder has\r\ncollected all the data and information they needed from the instance and expect no additional data to be added to it.\r\nThe body of the request isn't used for anything despite this being a POST operation.",
2548+
"description": "Add to an instance that a given stakeholder considers the instance as no longer needed by them. The stakeholder has\ncollected all the data and information they needed from the instance and expect no additional data to be added to it.\nThe body of the request isn't used for anything despite this being a POST operation.",
25462549
"parameters": [
25472550
{
25482551
"name": "instanceOwnerPartyId",
@@ -2918,6 +2921,7 @@
29182921
"name": "queryParams",
29192922
"in": "query",
29202923
"description": "Query parameters supplied",
2924+
"style": "deepObject",
29212925
"schema": {
29222926
"type": "object",
29232927
"additionalProperties": {
@@ -3023,6 +3027,7 @@
30233027
"name": "queryParams",
30243028
"in": "query",
30253029
"description": "Query parameteres supplied",
3030+
"style": "deepObject",
30263031
"schema": {
30273032
"type": "object",
30283033
"additionalProperties": {
@@ -3864,7 +3869,7 @@
38643869
"tags": [
38653870
"Process"
38663871
],
3867-
"summary": "Gets a list of the next process elements that can be reached from the current process element.\r\nIf process is not started it returns the possible start events.",
3872+
"summary": "Gets a list of the next process elements that can be reached from the current process element.\nIf process is not started it returns the possible start events.",
38683873
"parameters": [
38693874
{
38703875
"name": "org",
@@ -4169,7 +4174,7 @@
41694174
"tags": [
41704175
"Process"
41714176
],
4172-
"summary": "Attemts to end the process by running next until an end event is reached.\r\nNotice that process must have been started.",
4177+
"summary": "Attemts to end the process by running next until an end event is reached.\nNotice that process must have been started.",
41734178
"parameters": [
41744179
{
41754180
"name": "org",
@@ -4551,7 +4556,7 @@
45514556
"tags": [
45524557
"Resource"
45534558
],
4554-
"summary": "Get the form layout\r\n<param name=\"org\">Unique identifier of the organisation responsible for the app.</param><param name=\"app\">Application identifier which is unique within an organisation.</param><returns>A collection of FormLayout objects in JSON format.</returns>",
4559+
"summary": "Get the form layout\n<param name=\"org\">Unique identifier of the organisation responsible for the app.</param><param name=\"app\">Application identifier which is unique within an organisation.</param><returns>A collection of FormLayout objects in JSON format.</returns>",
45554560
"parameters": [
45564561
{
45574562
"name": "org",
@@ -4732,7 +4737,7 @@
47324737
"tags": [
47334738
"Resource"
47344739
],
4735-
"summary": "Get the rule settings\r\n<param name=\"org\">Unique identifier of the organisation responsible for the app.</param><param name=\"app\">Application identifier which is unique within an organisation.</param><param name=\"id\">The layoutset id</param><returns>A collection of FormLayout objects in JSON format.</returns>",
4740+
"summary": "Get the rule settings\n<param name=\"org\">Unique identifier of the organisation responsible for the app.</param><param name=\"app\">Application identifier which is unique within an organisation.</param><param name=\"id\">The layoutset id</param><returns>A collection of FormLayout objects in JSON format.</returns>",
47364741
"parameters": [
47374742
{
47384743
"name": "org",
@@ -5534,7 +5539,7 @@
55345539
"tags": [
55355540
"Validate"
55365541
],
5537-
"summary": "Validate an app instance. This will validate all individual data elements, both the binary elements and the elements bound\r\nto a model, and then finally the state of the instance.",
5542+
"summary": "Validate an app instance. This will validate all individual data elements, both the binary elements and the elements bound\nto a model, and then finally the state of the instance.",
55385543
"parameters": [
55395544
{
55405545
"name": "org",
@@ -6476,7 +6481,7 @@
64766481
"items": {
64776482
"type": "string"
64786483
},
6479-
"description": "List of validators to ignore during the patch operation.\r\nIssues from these validators will not be run during the save operation, but the validator will run on process/next",
6484+
"description": "List of validators to ignore during the patch operation.\nIssues from these validators will not be run during the save operation, but the validator will run on process/next",
64806485
"nullable": true
64816486
}
64826487
},
@@ -6503,12 +6508,12 @@
65036508
"items": {
65046509
"type": "string"
65056510
},
6506-
"description": "List of validators to ignore during the patch operation.\r\nIssues from these validators will not be run during the save operation, but the validator will run on process/next",
6511+
"description": "List of validators to ignore during the patch operation.\nIssues from these validators will not be run during the save operation, but the validator will run on process/next",
65076512
"nullable": true
65086513
}
65096514
},
65106515
"additionalProperties": false,
6511-
"description": "Represents the request to patch data on the Altinn.App.Api.Controllers.DataController in the\r\nversion that supports multiple data models in the same request."
6516+
"description": "Represents the request to patch data on the Altinn.App.Api.Controllers.DataController in the\nversion that supports multiple data models in the same request."
65126517
},
65136518
"DataPatchResponse": {
65146519
"required": [
@@ -8064,7 +8069,7 @@
80648069
}
80658070
}
80668071
},
8067-
"description": "Gets a dictionary of updated validation issues. The first key is the data model id, the second key is the validator id\r\nValidators that are not listed in the dictionary are assumed to have not been executed",
8072+
"description": "Gets a dictionary of updated validation issues. The first key is the data model id, the second key is the validator id\nValidators that are not listed in the dictionary are assumed to have not been executed",
80688073
"nullable": true
80698074
},
80708075
"clientActions": {

test/Altinn.App.Api.Tests/Telemetry/TelemetryConfigurationTests.cs

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -183,44 +183,6 @@ public async Task AppInsights_Registers_Correctly()
183183
Assert.Equal("TestEvent", customEvent);
184184
}
185185

186-
[Fact]
187-
public async Task KeyedServices_Produces_Error_Diagnostics()
188-
{
189-
// This test just verifies that we rootcaused the issues re: https://github.com/Altinn/app-lib-dotnet/pull/594
190-
191-
using var listener = new AppInsightsListener();
192-
193-
var services = new ServiceCollection();
194-
var env = new FakeWebHostEnvironment { EnvironmentName = "Development" };
195-
196-
services.AddSingleton<IWebHostEnvironment>(env);
197-
services.AddSingleton<IHostingEnvironment>(env);
198-
199-
var config = new ConfigurationBuilder()
200-
.AddInMemoryCollection(
201-
[new KeyValuePair<string, string?>("ApplicationInsights:InstrumentationKey", "test")]
202-
)
203-
.Build();
204-
205-
// AppInsights SDK currently can't handle keyed services in the container
206-
// Hopefully we can remove all this soon
207-
services.AddKeyedSingleton<ITelemetryProcessor, TelemetryProcessor>("test");
208-
209-
Altinn.App.Api.Extensions.ServiceCollectionExtensions.AddAltinnAppServices(services, config, env);
210-
211-
await using (var sp = services.BuildServiceProvider())
212-
{
213-
var client = sp.GetService<TelemetryClient>();
214-
Assert.Null(client);
215-
}
216-
217-
await Task.Yield();
218-
219-
EventLevel[] errorLevels = [EventLevel.Error, EventLevel.Critical];
220-
var events = listener.Events;
221-
Assert.Contains(events, e => errorLevels.Contains(e.Level));
222-
}
223-
224186
[Fact]
225187
public async Task OpenTelemetry_Registers_Correctly_When_Enabled()
226188
{

0 commit comments

Comments
 (0)