Skip to content

Commit 4e24490

Browse files
authored
Upgrade SDK to 2024.2 (#110)
* Update code style and upgrade SDK version This commit introduces an updated code style in TemplateParameterNameAttributeProvider.cs and _build.csproj.DotSettings. The style of the code has been simplified to a more straightforward and cleaner format. * Update ShellComponent attribute in StructuredLoggingWikiDataProvider The ShellComponent attribute in the StructuredLoggingWikiDataProvider.cs file has been updated. The instantiation was changed to DemandAnyThreadSafe to ensure the component's safety across various threads. This change is important to maintain thread safety and avoid potential race conditions or deadlocks. * Update SdkVersion in Directory.Build.props The SdkVersion property in Directory.Build.props file has been updated. The version has been changed from 2024.2.0-eap06 to 2024.2.0-eap07. This update is a part of the regular sdk upgrade process. * Update SDK version in Directory.Build.props Changed the SDK version from 2024.2.0-eap07 to 2024.2.0-eap09. This ensures the project uses the latest SDK features and bug fixes. * Update SDK version to 2024.2.0-rc01 Updated the SDK version in Directory.Build.props from 2024.2.0-eap09 to 2024.2.0-rc01. This update ensures we are using the release candidate version for better stability and compatibility. * Update SdkVersion to the stable release version The SdkVersion has been changed from a release candidate (2024.2.0-rc01) to the stable version (2024.2.0) in the project properties. This ensures more reliability and stability for the builds.
1 parent f5a6297 commit 4e24490

File tree

4 files changed

+34
-37
lines changed

4 files changed

+34
-37
lines changed

Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
44
<PropertyGroup>
5-
<SdkVersion>2024.1.4</SdkVersion>
5+
<SdkVersion>2024.2.0</SdkVersion>
66
</PropertyGroup>
77
<!-- https://jetbrains.slack.com/archives/CBZ36NH7C/p1628090127002200 -->
88
<PropertyGroup>

build/_build.csproj.DotSettings

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ANONYMOUSMETHOD_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
1717
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
1818
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
19+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=4a98fdf6_002D7d98_002D4f5a_002Dafeb_002Dea44ad98c70c/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
20+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=f9fce829_002De6f4_002D4cb2_002D80f1_002D5497c44f51df/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
1921
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
2022
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
2123
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
@@ -24,4 +26,5 @@
2426
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
2527
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
2628
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
27-
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
29+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
30+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

src/ReSharper.Structured.Logging/Caching/TemplateParameterNameAttributeProvider.cs

+27-34
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,44 @@
55
using JetBrains.ReSharper.Psi;
66
using JetBrains.ReSharper.Psi.CodeAnnotations;
77

8-
namespace ReSharper.Structured.Logging.Caching
8+
namespace ReSharper.Structured.Logging.Caching;
9+
10+
[CodeAnnotationProvider]
11+
public class TemplateParameterNameAttributeProvider(
12+
AttributeInstancesProvider attributeInstancesProvider,
13+
CodeAnnotationsConfiguration codeAnnotationsConfiguration)
14+
: CodeAnnotationInfoProvider<ITypeMember, string>(attributeInstancesProvider, codeAnnotationsConfiguration, true)
915
{
10-
[CodeAnnotationProvider]
11-
public class TemplateParameterNameAttributeProvider : CodeAnnotationInfoProvider<ITypeMember, string>
16+
private const string MessageTemplateFormatMethodAttribute = "MessageTemplateFormatMethodAttribute";
17+
18+
protected override string CalculateInfo(ITypeMember attributesOwner, IEnumerable<IAttributeInstance> attributeInstances)
1219
{
13-
private const string MessageTemplateFormatMethodAttribute = "MessageTemplateFormatMethodAttribute";
20+
var templateFormatAttribute = attributeInstances
21+
.FirstOrDefault(a => string.Equals(a.GetAttributeShortName(), MessageTemplateFormatMethodAttribute, StringComparison.Ordinal));
1422

15-
public TemplateParameterNameAttributeProvider(
16-
AttributeInstancesProvider attributeInstancesProvider,
17-
CodeAnnotationsConfiguration codeAnnotationsConfiguration)
18-
: base(attributeInstancesProvider, codeAnnotationsConfiguration, true)
23+
if (templateFormatAttribute != null)
1924
{
25+
return templateFormatAttribute.PositionParameters()
26+
.FirstOrDefault()
27+
?.ConstantValue.StringValue;
2028
}
2129

22-
protected override string CalculateInfo(ITypeMember attributesOwner, IEnumerable<IAttributeInstance> attributeInstances)
30+
var className = attributesOwner.ContainingType?.GetClrName().FullName;
31+
if (className == "Microsoft.Extensions.Logging.LoggerExtensions")
2332
{
24-
var templateFormatAttribute = attributeInstances
25-
.FirstOrDefault(a => string.Equals(a.GetAttributeShortName(), MessageTemplateFormatMethodAttribute, StringComparison.Ordinal));
26-
27-
if (templateFormatAttribute != null)
28-
{
29-
return templateFormatAttribute.PositionParameters()
30-
.FirstOrDefault()
31-
?.ConstantValue.StringValue;
32-
}
33-
34-
var className = attributesOwner.ContainingType?.GetClrName().FullName;
35-
if (className == "Microsoft.Extensions.Logging.LoggerExtensions")
36-
{
37-
return attributesOwner.ShortName == "BeginScope" ? "messageFormat" : "message";
38-
}
39-
40-
if (className == "ZLogger.ZLoggerExtensions")
41-
{
42-
return "format";
43-
}
44-
45-
return null;
33+
return attributesOwner.ShortName == "BeginScope" ? "messageFormat" : "message";
4634
}
4735

48-
protected override string GetDefaultInfo(ITypeMember attributesOwner)
36+
if (className == "ZLogger.ZLoggerExtensions")
4937
{
50-
return null;
38+
return "format";
5139
}
5240

53-
public override string[] AttributeShortNames { get; } = { MessageTemplateFormatMethodAttribute };
41+
return null;
42+
}
43+
44+
protected override string GetDefaultInfo(ITypeMember attributesOwner)
45+
{
46+
return null;
5447
}
5548
}

src/ReSharper.Structured.Logging/Wiki/StructuredLoggingWikiDataProvider.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
using System.Collections.Generic;
22

33
using JetBrains.Application;
4+
using JetBrains.Application.Parts;
45
using JetBrains.ReSharper.Feature.Services.Explanatory;
56

67
using ReSharper.Structured.Logging.Highlighting;
78

89
namespace ReSharper.Structured.Logging.Wiki
910
{
10-
[ShellComponent]
11+
[ShellComponent(Instantiation.DemandAnyThreadSafe)]
1112
public class StructuredLoggingWikiDataProvider : ICodeInspectionWikiDataProvider
1213
{
1314
private static readonly IDictionary<string, string> AttributeUrlMap = new Dictionary<string, string>

0 commit comments

Comments
 (0)