Skip to content

Commit 4eb7aa0

Browse files
authored
Get rid of pre-.NET8 conditional code to simplify (#357)
* Get rid of pre-`.NET8` conditional code to simplify * Remove duplicated compilers * Remove duplicated compilers * Remove dup compilers * Fix conditions * Upgrade Nugets
1 parent 3751fb9 commit 4eb7aa0

File tree

44 files changed

+8
-382
lines changed

Some content is hidden

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

44 files changed

+8
-382
lines changed

Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<NoWarn Condition="$(MSBuildProjectName.Contains('Tests')) == 'true'">$(NoWarn);SYSLIB0011</NoWarn>
4343
<!-- Enable Usage of BinaryFormatter in test projects -->
4444
<EnableUnsafeBinaryFormatterSerialization
45-
Condition="('$(TargetFramework)'=='net8.0' OR '$(TargetFramework)'=='net9.0') AND $(MSBuildProjectName.Contains('Tests')) == 'true'">true</EnableUnsafeBinaryFormatterSerialization>
45+
Condition="('$(TargetFramework)'=='net10.0' OR '$(TargetFramework)'=='net9.0') AND $(MSBuildProjectName.Contains('Tests')) == 'true'">true</EnableUnsafeBinaryFormatterSerialization>
4646
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4747
</PropertyGroup>
4848

Directory.Packages.props

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<Project>
22
<PropertyGroup>
33
<MSExtVersion Condition="'$(TargetFramework)' == 'net9.0'">9.0.0</MSExtVersion>
4-
<MSExtVersion Condition="'$(TargetFramework)' == 'net8.0'">8.0.0</MSExtVersion>
4+
<MSExtVersion Condition="'$(TargetFramework)' == 'net10.0'">10.0.0</MSExtVersion>
55
<MSExtVersion2>$(MSExtVersion)</MSExtVersion2>
6-
<MSExtVersion2 Condition="'$(TargetFramework)' == 'net8.0'">8.0.1</MSExtVersion2>
6+
<MSExtVersion2 Condition="'$(TargetFramework)' == 'net10.0'">10.0.0</MSExtVersion2>
77
</PropertyGroup>
88
<ItemGroup Label="Nupkg Versions">
99
<PackageVersion Include="System.CodeDom" Version="$(MSExtVersion)"/>
@@ -15,7 +15,6 @@
1515
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="$(MSExtVersion2)" />
1616
<PackageVersion Include="Microsoft.Extensions.Configuration.Xml" Version="$(MSExtVersion2)" />
1717
<PackageVersion Include="System.Data.SQLite.Core" Version="1.0.119" />
18-
<PackageVersion Include="System.Dynamic.Runtime" Version="4.3.0" />
1918
<PackageVersion Include="System.Spatial" Version="5.8.5" />
2019
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
2120
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
@@ -25,10 +24,10 @@
2524
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(MSExtVersion2)" />
2625
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
2726
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.0.0" />
28-
<PackageVersion Include="BitFaster.Caching" Version="2.5.2" />
27+
<PackageVersion Include="BitFaster.Caching" Version="2.5.3" />
2928
<PackageVersion Include="FirebirdSql.Data.FirebirdClient" Version="8.5.3" />
3029
<PackageVersion Include="FSharp.Core" Version="4.7.0" />
31-
<PackageVersion Include="Google.Protobuf" Version="3.28.3" />
30+
<PackageVersion Include="Google.Protobuf" Version="3.29.3" />
3231
<PackageVersion Include="log4net" Version="2.0.10" />
3332
<PackageVersion Include="Mono.Cecil" Version="0.11.6" />
3433
<PackageVersion Include="MySql.Data" Version="8.0.31" />

Extensions/Xtensive.Orm.BulkOperations/Internals/Operation.cs

-4
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,7 @@ protected void EnsureTransactionIsStarted()
6868
public QueryTranslationResult GetRequest(IQueryable<T> query) => QueryBuilder.TranslateQuery(query);
6969

7070
public QueryTranslationResult GetRequest(Type type, IQueryable query) =>
71-
#if NET8_0_OR_GREATER
7271
(QueryTranslationResult) WellKnownMembers.TranslateQueryMethod.CachedMakeGenericMethodInvoker(type).Invoke(QueryBuilder, query);
73-
#else
74-
(QueryTranslationResult) WellKnownMembers.TranslateQueryMethod.CachedMakeGenericMethod(type).Invoke(QueryBuilder, new object[] {query});
75-
#endif
7672

7773
public TypeInfo GetTypeInfo(Type entityType) =>
7874
Session.Domain.Model.Hierarchies.SelectMany(a => a.Types).Single(a => a.UnderlyingType == entityType);

MSBuild/DataObjects.Net.targets

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<XtensiveOrmPath Condition="'$(XtensiveOrmPath)'==''">$(MSBuildThisFileDirectory)</XtensiveOrmPath>
1414
<XtensiveOrmPath Condition="!HasTrailingSlash('$(XtensiveOrmPath)')">$(XtensiveOrmPath)\</XtensiveOrmPath>
1515
<XtensiveWeaverFramework>net9.0</XtensiveWeaverFramework>
16-
<XtensiveWeaverFramework Condition="'$(TargetFramework)'=='net8.0'">net8.0</XtensiveWeaverFramework>
16+
<XtensiveWeaverFramework Condition="'$(TargetFramework)'=='net10.0'">net10.0</XtensiveWeaverFramework>
1717
<XtensiveOrmWeaver Condition="'$(XtensiveOrmWeaver)'==''">$(XtensiveOrmPath)tools\weaver\$(XtensiveWeaverFramework)\Xtensive.Orm.Weaver.dll</XtensiveOrmWeaver>
1818
<XtensiveOrmBuildDependsOn>$(XtensiveOrmBuildDependsOn)</XtensiveOrmBuildDependsOn>
1919
</PropertyGroup>

Orm/Xtensive.Orm.Tests.Core/DotNetFramework/AllocationTest.cs

-26
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@ private void TestClassAllocation(double speedFactor)
9292
// Warmup
9393
int iterations = 100;
9494
AllocateClass_SlimObject(iterations);
95-
#if !NET8_0_OR_GREATER
96-
AllocateClass_SlimObject_ByFormatterServices(iterations);
97-
#endif
9895
AllocateClass_FinalizableSlimObject(iterations);
9996
AllocateClass_InheritedObject3(iterations);
10097
AllocateClass<SlimObject>(iterations);
@@ -112,10 +109,6 @@ private void TestClassAllocation(double speedFactor)
112109
using (new Measurement("SlimObject", MeasurementOptions.Log, iterations))
113110
AllocateClass_SlimObject(iterations);
114111
TestHelper.CollectGarbage();
115-
#if !NET8_0_OR_GREATER
116-
using (new Measurement("SlimObject (using FormatterServices)", MeasurementOptions.Log, iterations))
117-
AllocateClass_SlimObject_ByFormatterServices(iterations);
118-
#endif
119112
TestHelper.CollectGarbage();
120113
using (new Measurement("FinalizableSlimObject", MeasurementOptions.Log, iterations))
121114
AllocateClass_FinalizableSlimObject(iterations);
@@ -213,25 +206,6 @@ private void AllocateClass_InheritedObject3(int iterationCount)
213206
new InheritedObject3();
214207
}
215208
}
216-
#if !NET8_0_OR_GREATER
217-
218-
private void AllocateClass_SlimObject_ByFormatterServices(int iterationCount)
219-
{
220-
var type = typeof(SlimObject);
221-
for (int i = 0; i<iterationCount; i+=10) {
222-
FormatterServices.GetUninitializedObject(type);
223-
FormatterServices.GetUninitializedObject(type);
224-
FormatterServices.GetUninitializedObject(type);
225-
FormatterServices.GetUninitializedObject(type);
226-
FormatterServices.GetUninitializedObject(type);
227-
FormatterServices.GetUninitializedObject(type);
228-
FormatterServices.GetUninitializedObject(type);
229-
FormatterServices.GetUninitializedObject(type);
230-
FormatterServices.GetUninitializedObject(type);
231-
FormatterServices.GetUninitializedObject(type);
232-
}
233-
}
234-
#endif
235209

236210
private void AllocateClass_FinalizableSlimObject(int iterationCount)
237211
{

Orm/Xtensive.Orm.Tests.Core/Modelling/IndexingModel/Exceptions/ValidationException.cs

-4
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ public ValidationException(string message, string nodePath)
5353
#region Serializing members
5454

5555
/// <inheritdoc/>
56-
#if NET8_0_OR_GREATER
5756
[Obsolete(DiagnosticId = "SYSLIB0051")]
58-
#endif
5957
protected ValidationException(SerializationInfo info, StreamingContext context)
6058
: base(info, context)
6159
{
@@ -64,9 +62,7 @@ protected ValidationException(SerializationInfo info, StreamingContext context)
6462

6563
/// <inheritdoc/>
6664
[SecurityCritical]
67-
#if NET8_0_OR_GREATER
6865
[Obsolete(DiagnosticId = "SYSLIB0051")]
69-
#endif
7066
public override void GetObjectData(SerializationInfo info, StreamingContext context)
7167
{
7268
info.AddValue("NodePath", NodePath);

Orm/Xtensive.Orm.Tests/Linq/DateTimeAndDateTimeOffset/DateTime/ComparisonTest.cs

-7
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ public void EqualsTest()
2424
RunWrongTest<SingleDateTimeEntity>(c => c.MillisecondDateTime==WrongMillisecondDateTime);
2525
RunWrongTest<SingleDateTimeEntity>(c => c.NullableDateTime==WrongDateTime);
2626
RunWrongTest<SingleDateTimeEntity>(c => c.NullableDateTime==null);
27-
#if NET_6_0_OR_GREATER
28-
RunTest<SingleDateTimeEntity>(c => c.DateOnly == FirstDateOnly);
29-
RunTest<SingleDateTimeEntity>(c => c.NullableDateOnly == NullableDateOnly);
30-
#endif
3127
});
3228
}
3329

@@ -38,9 +34,6 @@ public void NotEqualTest()
3834
RunTest<SingleDateTimeEntity>(c=>c.DateTime!=FirstDateTime.AddYears(1));
3935
RunTest<SingleDateTimeEntity>(c => c.MillisecondDateTime!=FirstMillisecondDateTime.AddYears(1));
4036
RunTest<SingleDateTimeEntity>(c=>c.NullableDateTime!=NullableDateTime.AddYears(1));
41-
#if NET_6_0_OR_GREATER
42-
RunTest<SingleDateTimeEntity>(c => c.DateOnly != FirstDateOnly.AddYears(1));
43-
#endif
4437
});
4538
}
4639

Orm/Xtensive.Orm.Tests/Linq/DateTimeAndDateTimeOffset/DateTime/JoinTest.cs

+1-9
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,6 @@ public void DateTimeJoinTest()
2121
(left, right) => new JoinResult<DateTime> { LeftId = left.Id, RightId = right.Id, LeftDateTime = left.DateTime, RightDateTime = right.DateTime },
2222
c => c.LeftId,
2323
c => c.RightId));
24-
#if NET_6_0_OR_GREATER
25-
ExecuteInsideSession(() => JoinPrivate<DateTimeEntity, DateTimeEntity, JoinResult<DateOnly>, DateOnly, long>(
26-
left => left.DateOnly,
27-
right => right.DateOnly,
28-
(left, right) => new JoinResult<DateOnly> { LeftId = left.Id, RightId = right.Id, LeftDateTime = left.DateOnly, RightDateTime = right.DateOnly },
29-
c => c.LeftId,
30-
c => c.RightId));
31-
#endif
3224
}
3325

3426
[Test]
@@ -83,4 +75,4 @@ private static void JoinPrivate<T1, T2, T3, TK1, TK3>(Session session,
8375
Assert.IsFalse(joinLocal.SequenceEqual(joinServer));
8476
}
8577
}
86-
}
78+
}

Orm/Xtensive.Orm.Tests/Linq/DateTimeAndDateTimeOffset/DateTime/OperationsTest.cs

-31
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@ public void AddYearsTest()
2222
RunWrongTest<SingleDateTimeEntity>(c => c.DateTime.AddYears(1) == FirstDateTime.AddYears(2));
2323
RunWrongTest<SingleDateTimeEntity>(c => c.MillisecondDateTime.AddYears(-1) == FirstMillisecondDateTime.AddYears(-2));
2424
RunWrongTest<SingleDateTimeEntity>(c => c.NullableDateTime.Value.AddYears(33) == NullableDateTime.AddYears(44));
25-
#if NET_6_0_OR_GREATER
26-
RunTest<SingleDateTimeEntity>(c => c.DateOnly.AddYears(1) == FirstDateOnly.AddYears(1));
27-
RunTest<SingleDateTimeEntity>(c => c.NullableDateOnly.Value.AddYears(33) == NullableDateOnly.AddYears(33));
28-
29-
RunWrongTest<SingleDateTimeEntity>(c => c.DateOnly.AddYears(1) == FirstDateOnly.AddYears(2));
30-
RunWrongTest<SingleDateTimeEntity>(c => c.NullableDateOnly.Value.AddYears(33) == NullableDateOnly.AddYears(44));
31-
#endif
3225
});
3326
}
3427

@@ -43,13 +36,6 @@ public void AddMonthsTest()
4336
RunWrongTest<SingleDateTimeEntity>(c => c.DateTime.AddMonths(1) == FirstDateTime.AddMonths(2));
4437
RunWrongTest<SingleDateTimeEntity>(c => c.MillisecondDateTime.AddMonths(-1) == FirstMillisecondDateTime.AddMonths(-2));
4538
RunWrongTest<SingleDateTimeEntity>(c => c.NullableDateTime.Value.AddMonths(33) == NullableDateTime.AddMonths(44));
46-
#if NET_6_0_OR_GREATER
47-
RunTest<SingleDateTimeEntity>(c => c.DateOnly.AddMonths(1) == FirstDateOnly.AddMonths(1));
48-
RunTest<SingleDateTimeEntity>(c => c.NullableDateOnly.Value.AddMonths(33) == NullableDateOnly.AddMonths(33));
49-
50-
RunWrongTest<SingleDateTimeEntity>(c => c.DateOnly.AddMonths(1) == FirstDateOnly.AddMonths(2));
51-
RunWrongTest<SingleDateTimeEntity>(c => c.NullableDateOnly.Value.AddMonths(33) == NullableDateOnly.AddMonths(44));
52-
#endif
5339
});
5440
}
5541

@@ -64,13 +50,6 @@ public void AddDaysTest()
6450
RunWrongTest<SingleDateTimeEntity>(c => c.DateTime.AddDays(1) == FirstDateTime.AddDays(2));
6551
RunWrongTest<SingleDateTimeEntity>(c => c.MillisecondDateTime.AddDays(-1) == FirstMillisecondDateTime.AddDays(-2));
6652
RunWrongTest<SingleDateTimeEntity>(c => c.NullableDateTime.Value.AddDays(33) == NullableDateTime.AddDays(44));
67-
#if NET_6_0_OR_GREATER
68-
RunTest<SingleDateTimeEntity>(c => c.DateOnly.AddDays(1) == FirstDateOnly.AddDays(1));
69-
RunTest<SingleDateTimeEntity>(c => c.NullableDateOnly.Value.AddDays(33) == NullableDateOnly.AddDays(33));
70-
71-
RunWrongTest<SingleDateTimeEntity>(c => c.DateOnly.AddDays(1) == FirstDateOnly.AddDays(2));
72-
RunWrongTest<SingleDateTimeEntity>(c => c.NullableDateOnly.Value.AddDays(33) == NullableDateOnly.AddDays(44));
73-
#endif
7453
});
7554
}
7655

@@ -99,11 +78,6 @@ public void AddMinutesTest()
9978
RunWrongTest<SingleDateTimeEntity>(c => c.DateTime.AddMinutes(1) == FirstDateTime.AddMinutes(2));
10079
RunWrongTest<SingleDateTimeEntity>(c => c.MillisecondDateTime.AddMinutes(-1) == FirstMillisecondDateTime.AddMinutes(-2));
10180
RunWrongTest<SingleDateTimeEntity>(c => c.NullableDateTime.Value.AddMinutes(33) == NullableDateTime.AddMinutes(44));
102-
#if NET_6_0_OR_GREATER
103-
RunTest<SingleDateTimeEntity>(c => c.TimeOnly.AddMinutes(1) == FirstTimeOnly.AddMinutes(1));
104-
105-
RunWrongTest<SingleDateTimeEntity>(c => c.TimeOnly.AddMinutes(1) == FirstTimeOnly.AddMinutes(2));
106-
#endif
10781
});
10882
}
10983

@@ -214,11 +188,6 @@ public void MinusDateTimeTest()
214188
RunWrongTest<SingleDateTimeEntity>(c => c.DateTime - SecondDateTime == FirstDateTime - WrongDateTime);
215189
RunWrongTest<SingleDateTimeEntity>(c => c.MillisecondDateTime - SecondDateTime == FirstMillisecondDateTime - WrongDateTime);
216190
RunWrongTest<SingleDateTimeEntity>(c => c.NullableDateTime - SecondDateTime == NullableDateTime - WrongDateTime);
217-
218-
#if NET_6_0_OR_GREATER
219-
RunTest<SingleDateTimeEntity>(c => c.TimeOnly - SecondTimeOnly == FirstTimeOnly - SecondTimeOnly);
220-
RunWrongTest<SingleDateTimeEntity>(c => c.TimeOnly - SecondTimeOnly == FirstTimeOnly - WrongTimeOnly);
221-
#endif
222191
});
223192
}
224193

Orm/Xtensive.Orm.Tests/Linq/DateTimeAndDateTimeOffset/DateTimeBaseTest.cs

+1-6
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ protected override void PopulateEntities(Session session)
5757
_ = new SingleDateTimeEntity(session) {
5858
DateTime = FirstDateTime,
5959
MillisecondDateTime = FirstMillisecondDateTime,
60-
#if NET_6_0_OR_GREATER
61-
DateOnly = DateOnly.FromDateTime(FirstDateTime),
62-
NullableDateOnly = DateOnly.FromDateTime(NullableDateTime),
63-
TimeOnly = FirstTimeOnly,
64-
#endif
6560
NullableDateTime = NullableDateTime
6661
};
6762

@@ -205,4 +200,4 @@ protected override void PopulateEntities(Session session)
205200
_ = AllPossiblePartsEntity.FromDateTime(session, FirstMillisecondDateTime, 321);
206201
}
207202
}
208-
}
203+
}

Orm/Xtensive.Orm.Tests/Model/HierarchyRootValidationTest.cs

-4
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ public void InvalidNonPersistentKeyTypesForDefaultGeneratorTest()
258258
Assert.That(ex.Message.Contains(UnableToCreateKeyForMsg));
259259
}
260260

261-
#if NET6_0_OR_GREATER
262261
configuration = CreateDomainConfiguration(new[] { typeof(Models.NonPersistentStorageSupporedTypesAsKeys.TimeOnlyKeyEntity) });
263262
Assert.DoesNotThrow(() => domain = Domain.Build(configuration));
264263
Assert.That(domain, Is.Not.Null);
@@ -294,7 +293,6 @@ public void InvalidNonPersistentKeyTypesForDefaultGeneratorTest()
294293
});
295294
Assert.That(ex.Message.Contains(UnableToCreateKeyForMsg));
296295
}
297-
#endif
298296

299297
configuration = CreateDomainConfiguration(new[] { typeof(Models.NonPersistentStorageSupporedTypesAsKeys.DateTimeKeyEntity) });
300298
Assert.DoesNotThrow(() => domain = Domain.Build(configuration));
@@ -1621,7 +1619,6 @@ public TimeSpanKeyEntity(Session session)
16211619
}
16221620
}
16231621

1624-
#if NET6_0_OR_GREATER
16251622

16261623
[HierarchyRoot]
16271624
public class TimeOnlyKeyEntity : Entity
@@ -1655,7 +1652,6 @@ public DateOnlyKeyEntity(Session session)
16551652
}
16561653
}
16571654

1658-
#endif
16591655

16601656
[HierarchyRoot]
16611657
public class DateTimeKeyEntity : Entity

Orm/Xtensive.Orm.Tests/Storage/SchemaSharing/EntityManipulation/Model.cs

-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@ public class TestEntity1 : Entity
1919
[Field]
2020
public string Text { get; set; }
2121

22-
#if NET_6_0_OR_GREATER
2322
[Field]
2423
public DateOnly DateOnly { get; set; }
2524

2625
[Field]
2726
public TimeOnly TimeOnly { get; set; }
28-
#endif
2927

3028
[Field]
3129
public string DatabaseName { get; set; }

Orm/Xtensive.Orm.Tests/Storage/SchemaSharing/EntityManipulation/SimpleEntityManipulationTest.cs

-4
Original file line numberDiff line numberDiff line change
@@ -414,20 +414,16 @@ private void Update(Session session, Key[] createdKeys, int initialCountOfEntiti
414414
var now = DateTime.UtcNow;
415415

416416
a.Text = updatedText;
417-
#if NET_6_0_OR_GREATER
418417
var dateOnly = DateOnly.FromDateTime(now);
419418
var timeOnly = TimeOnly.FromDateTime(now);
420419
a.DateOnly = dateOnly;
421420
a.TimeOnly = timeOnly;
422-
#endif
423421
session.SaveChanges();
424422

425423
Assert.That(session.Query.All<model.Part1.TestEntity1>().Count(), Is.EqualTo(initialCountOfEntities + 1));
426424
Assert.That(session.Query.All<model.Part1.TestEntity1>().FirstOrDefault(e => e.Text == updatedText), Is.Not.Null);
427-
#if NET_6_0_OR_GREATER
428425
Assert.AreEqual(session.Query.All<model.Part1.TestEntity1>().FirstOrDefault(e => e.Text == updatedText).DateOnly, dateOnly);
429426
Assert.AreEqual(session.Query.All<model.Part1.TestEntity1>().FirstOrDefault(e => e.Text == updatedText).TimeOnly, timeOnly);
430-
#endif
431427
Assert.That(session.Query.All<model.Part1.TestEntity1>().FirstOrDefault(e => e.Text == text), Is.Null);
432428
Assert.That(
433429
session.Query.All<model.Part1.TestEntity1>()

Orm/Xtensive.Orm.Tests/Xtensive.Orm.Tests.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
<PackageReference Include="NUnit" />
2121
<PackageReference Include="NUnit3TestAdapter" />
2222
<PackageReference Include="System.Spatial" />
23-
<PackageReference Include="System.Dynamic.Runtime" />
2423
<PackageReference Include="Microsoft.Extensions.Configuration" />
2524
<PackageReference Include="Microsoft.Extensions.Configuration.Json" />
2625
<PackageReference Include="Microsoft.Extensions.Configuration.Xml" />

Orm/Xtensive.Orm/Core/Exceptions/ActivationException.cs

-2
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ public ActivationException(string message, Exception innerException)
4848
/// </summary>
4949
/// <param name="info"></param>
5050
/// <param name="context"></param>
51-
#if NET8_0_OR_GREATER
5251
[Obsolete(DiagnosticId = "SYSLIB0051")]
53-
#endif
5452
protected ActivationException(SerializationInfo info, StreamingContext context)
5553
: base(info, context)
5654
{

Orm/Xtensive.Orm/Core/Exceptions/InstanceIsLockedException.cs

-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ public InstanceIsLockedException(string text)
4040
/// </summary>
4141
/// <param name="info"><see cref="SerializationInfo"/> object.</param>
4242
/// <param name="context"><see cref="StreamingContext"/> object.</param>
43-
#if NET8_0_OR_GREATER
4443
[Obsolete(DiagnosticId = "SYSLIB0051")]
45-
#endif
4644
protected InstanceIsLockedException(SerializationInfo info, StreamingContext context)
4745
: base(info, context)
4846
{

Orm/Xtensive.Orm/Core/Internals/ValueStringBuilder.cs

-4
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,7 @@ public void Append(string? s)
150150
Grow(s.Length);
151151
}
152152

153-
#if NET6_0_OR_GREATER
154153
s.CopyTo(chars.Slice(origPos));
155-
#else
156-
s.AsSpan().CopyTo(chars.Slice(origPos));
157-
#endif
158154
position += s.Length;
159155
}
160156
}

Orm/Xtensive.Orm/IoC/ServiceContainer.cs

-13
Original file line numberDiff line numberDiff line change
@@ -184,28 +184,15 @@ public static IServiceContainer Create(Type containerType, object configuration,
184184
Type configurationType = configuration?.GetType(),
185185
parentType = parent?.GetType();
186186
return (IServiceContainer) (
187-
#if NET8_0_OR_GREATER
188187
FindConstructorInvoker(containerType, configurationType, parentType)?.Invoke(configuration, parent)
189188
?? FindConstructorInvoker(containerType, configurationType)?.Invoke(configuration)
190189
?? FindConstructorInvoker(containerType, parentType)?.Invoke(parent)
191-
#else
192-
FindConstructor(containerType, configurationType, parentType)?.Invoke(new[] { configuration, parent })
193-
?? FindConstructor(containerType, configurationType)?.Invoke(new[] { configuration })
194-
?? FindConstructor(containerType, parentType)?.Invoke(new[] { parent })
195-
#endif
196190
?? throw new ArgumentException(Strings.ExContainerTypeDoesNotProvideASuitableConstructor, "containerType")
197191
);
198192
}
199193

200-
#if NET8_0_OR_GREATER
201194
private static ConstructorInvoker FindConstructorInvoker(Type containerType, params Type[] argumentTypes) =>
202195
containerType.GetSingleConstructorInvokerOrDefault(argumentTypes);
203-
#else
204-
#pragma warning disable CS0612 // Type or member is obsolete
205-
private static ConstructorInfo FindConstructor(Type containerType, params Type[] argumentTypes) =>
206-
containerType.GetSingleConstructorOrDefault(argumentTypes);
207-
#pragma warning restore CS0612 // Type or member is obsolete
208-
#endif
209196

210197
#endregion
211198

0 commit comments

Comments
 (0)