Skip to content

Commit e3f28c6

Browse files
committed
Enable Roslyn analysis - Test Applicatiosn - part I
1 parent b538ed1 commit e3f28c6

File tree

90 files changed

+637
-308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+637
-308
lines changed

test/OpenTelemetry.AutoInstrumentation.Native.Tests/clr_helper_test.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,10 @@ TEST_F(CLRHelperTest, GetsTypeInfoFromTypeDefs)
106106

107107
TEST_F(CLRHelperTest, GetsTypeInfoFromTypeRefs)
108108
{
109-
std::set<std::wstring> expected = {L"DebuggingModes",
109+
std::set<std::wstring> expected = {L"ConfiguredTaskAwaiter",
110+
L"DebuggingModes",
110111
L"Enumerator",
112+
L"System.ArgumentNullException",
111113
L"System.Array",
112114
L"System.Attribute",
113115
L"System.AttributeTargets",
@@ -139,12 +141,11 @@ TEST_F(CLRHelperTest, GetsTypeInfoFromTypeRefs)
139141
L"System.Reflection.AssemblyTitleAttribute",
140142
L"System.Runtime.CompilerServices.AsyncStateMachineAttribute",
141143
L"System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1",
144+
L"System.Runtime.CompilerServices.ConfiguredTaskAwaitable",
142145
L"System.Runtime.CompilerServices.CompilationRelaxationsAttribute",
143146
L"System.Runtime.CompilerServices.CompilerGeneratedAttribute",
144147
L"System.Runtime.CompilerServices.IAsyncStateMachine",
145148
L"System.Runtime.CompilerServices.RuntimeCompatibilityAttribute",
146-
L"System.Runtime.CompilerServices.TaskAwaiter",
147-
L"System.Runtime.CompilerServices.TaskAwaiter`1",
148149
L"System.Runtime.Versioning.TargetFrameworkAttribute",
149150
L"System.RuntimeTypeHandle",
150151
L"System.String",

test/test-applications/integrations/Directory.Build.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,9 @@
1212
<ItemGroup>
1313
<Compile Include="$(MSBuildThisFileDirectory)GlobalSuppressions.cs" Link="GlobalSuppressions.integrations.cs" />
1414
</ItemGroup>
15+
<PropertyGroup>
16+
<!-- CA1031: Do not catch general exception types -->
17+
<!-- CA1303: Do not pass literals as localized parameters -->
18+
<NoWarn>$(NoWarn);CA1031;CA1303</NoWarn>
19+
</PropertyGroup>
1520
</Project>

test/test-applications/integrations/TestApplication.Azure/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
var containerClient = blobServiceClient.GetBlobContainerClient(containerName);
2222

2323
// Create the container if it does not exist
24-
await containerClient.CreateIfNotExistsAsync();
24+
await containerClient.CreateIfNotExistsAsync().ConfigureAwait(false);
2525

26-
var exists = await containerClient.ExistsAsync();
26+
var exists = await containerClient.ExistsAsync().ConfigureAwait(false);
2727

2828
Console.WriteLine(exists);
2929

test/test-applications/integrations/TestApplication.ContinuousProfiler.ContextTracking/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static async Task Main(string[] args)
1616
// and verify that trace context flows properly between threads that carry out parts of the async operation.
1717
using var activity = Source.StartActivity();
1818

19-
await DoSomethingAsync();
19+
await DoSomethingAsync().ConfigureAwait(false);
2020
}
2121

2222
private static async Task DoSomethingAsync()

test/test-applications/integrations/TestApplication.ContinuousProfiler/ClassA.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ public static void MethodAOthers<T>(
117117
#endif
118118
private static extern int OTelAutoCallbackTest(Callback fp, int n);
119119

120-
internal static class InternalClassB<TA, TD>
120+
internal static class InternalClassB<T1, T4>
121121
{
122122
internal static class DoubleInternalClassB
123123
{
124-
internal static class TripleInternalClassB<TC>
124+
internal static class TripleInternalClassB<T3>
125125
{
126126
[MethodImpl(MethodImplOptions.NoInlining)]
127-
public static void MethodB<TB>(int testArg, TC[] a, TB b, TD t, IList<TA> c, IList<string> d)
127+
public static void MethodB<T2>(int testArg, T3[] a, T2 b, T4 t, IList<T1> c, IList<string> d)
128128
{
129129
OTelAutoCallbackTest(TestCallback, testArg);
130130
}

test/test-applications/integrations/TestApplication.ContinuousProfiler/Exporter/AllocationSample.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace TestApplication.ContinuousProfiler;
55

6-
internal class AllocationSample
6+
internal sealed class AllocationSample
77
{
88
public AllocationSample(long allocationSizeBytes, string allocationTypeName, ThreadSample threadSample)
99
{

test/test-applications/integrations/TestApplication.ContinuousProfiler/Exporter/ExtendedPprofBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace TestApplication.ContinuousProfiler;
1111

12-
internal class ExtendedPprofBuilder
12+
internal sealed class ExtendedPprofBuilder
1313
{
1414
private readonly LocationCache _locationCache;
1515
private readonly LinkCache _linkCache;

test/test-applications/integrations/TestApplication.ContinuousProfiler/Exporter/OtlpOverHttpExporter.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
namespace TestApplication.ContinuousProfiler;
1616

17-
public class OtlpOverHttpExporter
17+
internal class OtlpOverHttpExporter
1818
{
1919
private const string MediaContentType = "application/x-protobuf";
2020

@@ -257,6 +257,11 @@ private static ScopeProfiles CreateScopeProfiles()
257257
return scopeProfiles;
258258
}
259259

260+
private static ExportRequestContent CreateHttpContent(ExportProfilesServiceRequest exportRequest)
261+
{
262+
return new ExportRequestContent(exportRequest);
263+
}
264+
260265
private HttpResponseMessage SendHttpRequest(HttpRequestMessage request, CancellationToken cancellationToken)
261266
{
262267
#if NET
@@ -266,11 +271,6 @@ private HttpResponseMessage SendHttpRequest(HttpRequestMessage request, Cancella
266271
#endif
267272
}
268273

269-
private HttpContent CreateHttpContent(ExportProfilesServiceRequest exportRequest)
270-
{
271-
return new ExportRequestContent(exportRequest);
272-
}
273-
274274
private HttpRequestMessage CreateHttpRequest(ExportProfilesServiceRequest exportRequest)
275275
{
276276
var request = new HttpRequestMessage(HttpMethod.Post, _endpoint);

test/test-applications/integrations/TestApplication.ContinuousProfiler/Exporter/ResourcesProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace TestApplication.ContinuousProfiler;
77

8-
internal class ResourcesProvider
8+
internal sealed class ResourcesProvider
99
{
1010
public static Resource Resource { get; private set; } = Resource.Empty;
1111

test/test-applications/integrations/TestApplication.ContinuousProfiler/Exporter/SampleBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace TestApplication.ContinuousProfiler;
77

8-
internal class SampleBuilder
8+
internal sealed class SampleBuilder
99
{
1010
private readonly Sample _sample = new();
1111
private long? _value;

0 commit comments

Comments
 (0)