Skip to content

Commit

Permalink
Merge pull request #613 from Jevonius/upgrade-castle-core
Browse files Browse the repository at this point in the history
Upgrade Castle.Core to 5.0.0 (resolves #612)
  • Loading branch information
jonorossi committed Jul 19, 2022
2 parents 855f258 + 2fbbfc1 commit 1973e70
Show file tree
Hide file tree
Showing 36 changed files with 98 additions and 177 deletions.
2 changes: 0 additions & 2 deletions README.md
Expand Up @@ -37,7 +37,6 @@ Symbol | .NET 4.5 | .NET Standard
`FEATURE_GAC` | :white_check_mark: | :no_entry_sign:
`FEATURE_GETCALLINGASSEMBLY` | :white_check_mark: | :no_entry_sign:
`FEATURE_ISUPPORTINITIALIZE` | :white_check_mark: | :no_entry_sign:
`FEATURE_NETCORE_REFLECTION_API` | :no_entry_sign: | :white_check_mark:
`FEATURE_PERFCOUNTERS`            | :white_check_mark: | :no_entry_sign:
`FEATURE_REMOTING` | :white_check_mark: | :no_entry_sign:
`FEATURE_SECURITY_PERMISSIONS` | :white_check_mark: | :no_entry_sign:
Expand All @@ -52,7 +51,6 @@ Symbol | .NET 4.5 | .NET Standard
* `FEATURE_GAC` - enables support for obtaining assemblies using an assembly's long form name.
* `FEATURE_GETCALLINGASSEMBLY` - enables code that uses `System.Reflection.Assembly.GetCallingAssembly()`.
* `FEATURE_ISUPPORTINITIALIZE` - enables support for features that make use of `System.ComponentModel.ISupportInitialize`.
* `FEATURE_NETCORE_REFLECTION_API` - provides shims to implement missing functionality in .NET Core that have no alternatives.
* `FEATURE_PERFCOUNTERS` - enables code that uses Windows Performance Counters.
* `FEATURE_REMOTING` - supports remoting on various types including inheriting from `MarshalByRefObject`.
* `FEATURE_SECURITY_PERMISSIONS` - enables the use of CAS and `Security[Critical|SafeCritical|Transparent]`.
Expand Down
6 changes: 1 addition & 5 deletions buildscripts/common.props
Expand Up @@ -35,14 +35,10 @@
<ContentTargetFolders>.</ContentTargetFolders>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net45'">
<PropertyGroup Condition="'$(TargetFramework)'=='net462'">
<DefineConstants>$(DefineConstants);FEATURE_PERFCOUNTERS;FEATURE_GAC;FEATURE_ISUPPORTINITIALIZE;FEATURE_REMOTING;FEATURE_SECURITY_PERMISSIONS;FEATURE_SYSTEM_CONFIGURATION;FEATURE_SERIALIZATION;FEATURE_URIMEMBERS;FEATURE_GETCALLINGASSEMBLY;FEATURE_APPDOMAIN;FEATURE_CODEDOM;FEATURE_ASSEMBLIES;CASTLE_SERVICES_LOGGING;FEATURE_EVENTLOG</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='netstandard1.6'">
<DefineConstants>$(DefineConstants);FEATURE_NETCORE_REFLECTION_API</DefineConstants>
</PropertyGroup>

<ItemGroup>
<Content Include="..\..\CHANGELOG.md" />
<Content Include="..\..\LICENSE">
Expand Down
2 changes: 1 addition & 1 deletion docs/Documentation.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461</TargetFrameworks>
<TargetFrameworks>net462</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45</TargetFrameworks>
<TargetFrameworks>net462</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\buildscripts\common.props"></Import>
Expand All @@ -14,7 +14,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Castle.Core" Version="4.4.1" />
<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.2.3" />
<PackageReference Include="Microsoft.Web.Infrastructure" Version="1.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
Expand Down
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45</TargetFrameworks>
<TargetFrameworks>net462</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\buildscripts\common.props"></Import>
Expand Down
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45</TargetFrameworks>
<TargetFrameworks>net462</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\buildscripts\common.props"></Import>
Expand All @@ -19,7 +19,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Castle.Core" Version="4.4.1" />
<PackageReference Include="NUnit" Version="3.8.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
Expand Down
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45</TargetFrameworks>
<TargetFrameworks>net462</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\buildscripts\common.props"></Import>
Expand Down
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45</TargetFrameworks>
<TargetFrameworks>net462</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\buildscripts\common.props"></Import>
Expand All @@ -14,7 +14,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Castle.Core" Version="4.4.1" />
<PackageReference Include="Microsoft.AspNet.WebApi" Version="5.2.3" />
<PackageReference Include="Microsoft.Web.Infrastructure" Version="1.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
Expand Down
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45</TargetFrameworks>
<TargetFrameworks>net462</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\buildscripts\common.props"></Import>
Expand Down
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\buildscripts\common.props"></Import>
Expand All @@ -24,6 +24,5 @@

<ItemGroup>
<Compile Include="..\..\buildscripts\CommonAssemblyInfo.cs" />
<Compile Include="..\Castle.Windsor\Compatibility\NetCoreReflectionExtensions.cs" />
</ItemGroup>
</Project>
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net45</TargetFramework>
<TargetFramework>net462</TargetFramework>
<NoWarn>$(NoWarn);1591</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand All @@ -10,11 +10,6 @@
<SignAssembly>false</SignAssembly>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Castle.Core" Version="4.4.1" />
<PackageReference Include="Castle.Core-log4net" Version="4.4.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Castle.Facilities.Logging\Castle.Facilities.Logging.csproj" />
<ProjectReference Include="..\Castle.Facilities.WcfIntegration\Castle.Facilities.WcfIntegration.csproj" />
Expand Down
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net45</TargetFramework>
<TargetFramework>net462</TargetFramework>

<NoWarn>$(NoWarn);1591</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand All @@ -12,8 +12,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Castle.Core" Version="4.4.1" />
<PackageReference Include="Castle.Core-log4net" Version="4.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="11.0.0" />
<PackageReference Include="NUnit" Version="3.8.1" />
Expand Down
Expand Up @@ -3,7 +3,7 @@
<Import Project="..\..\buildscripts\common.props"></Import>

<PropertyGroup>
<TargetFramework>net45</TargetFramework>
<TargetFramework>net462</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>Castle.WcfIntegrationFacility</PackageId>
<Title>Castle Windsor WCF integration facility</Title>
Expand Down
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net5.0;</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>

<IsPackable>false</IsPackable>

Expand Down
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
Expand Down
17 changes: 6 additions & 11 deletions src/Castle.Windsor.Tests/Castle.Windsor.Tests.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45;net5.0</TargetFrameworks>
<TargetFrameworks>net462;netcoreapp3.1</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\buildscripts\common.props"></Import>
Expand Down Expand Up @@ -49,10 +49,9 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net45'">
<PackageReference Include="Castle.Core" Version="4.4.1" />
<PackageReference Include="Castle.Core-log4net" Version="4.4.1" />
<PackageReference Include="Castle.Core-NLog" Version="4.4.1" />
<ItemGroup Condition="'$(TargetFramework)'=='net462'">
<PackageReference Include="Castle.Core-log4net" Version="[5.0.0,6.0)" />
<PackageReference Include="Castle.Core-NLog" Version="[5.0.0,6.0)" />
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="11.0.0" />
</ItemGroup>

Expand All @@ -61,7 +60,7 @@
<ProjectReference Include="..\Castle.Windsor\Castle.Windsor.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net45'">
<ItemGroup Condition="'$(TargetFramework)'=='net462'">
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System.Configuration" />
Expand All @@ -70,11 +69,7 @@
<Reference Include="WindowsBase" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\Castle.Windsor\Compatibility\AppContext.cs" />
</ItemGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net45'">
<PropertyGroup Condition="'$(TargetFramework)'=='net462'">
<DefineConstants>$(DefineConstants);NUNIT_SETCULTUREATTRIBUTE;NUNIT_TIMEOUTATTRIBUTE;FEATURE_THREADABORT;FEATURE_WPF;FEATURE_CONSOLETRACELISTENER</DefineConstants>
</PropertyGroup>

Expand Down
2 changes: 0 additions & 2 deletions src/Castle.Windsor.Tests/DefaultValueTestCase.cs
Expand Up @@ -94,7 +94,6 @@ public void Uses_explicit_value_over_default()
Assert.AreEqual("Adam Mickiewicz", value.Name);
}

#if !NETCOREAPP1_0 // FirstChanceException event was added in .NET Core 2.0
[Test]
public void First_chance_exceptions_are_not_thrown()
{
Expand All @@ -112,6 +111,5 @@ public HasCtorWithOptionalInterfaceParameter(IEqualityComparer<int> comparer = n
{
}
}
#endif
}
}
@@ -1,4 +1,4 @@
// Copyright 2004-2012 Castle Project - http://www.castleproject.org/
// Copyright 2004-2022 Castle Project - http://www.castleproject.org/
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -449,11 +449,18 @@ public void Proxying_type_with_no_default_ctor_throws_helpful_message()
.UsingFactoryMethod(() => new ClassWithConstructors("something")));

var exception =
Assert.Throws<InvalidProxyConstructorArgumentsException>(() => Kernel.Resolve<ClassWithConstructors>());
Assert.Throws<ArgumentException>(() => Kernel.Resolve<ClassWithConstructors>());

#if NET462_OR_GREATER
var expected =
"Can not instantiate proxy of class: Castle.MicroKernel.Tests.Configuration.Components.ClassWithConstructors." + Environment.NewLine +
"Could not find a parameterless constructor.";
"Could not find a parameterless constructor.\r\n" +
"Parameter name: constructorArguments";
#else
var expected =
"Can not instantiate proxy of class: Castle.MicroKernel.Tests.Configuration.Components.ClassWithConstructors." + Environment.NewLine +
"Could not find a parameterless constructor. (Parameter 'constructorArguments')";
#endif

Assert.AreEqual(expected, exception.Message);
}
Expand Down
2 changes: 0 additions & 2 deletions src/Castle.Windsor.Tests/TestUtils.cs
Expand Up @@ -25,7 +25,6 @@ namespace CastleTests

public static class TestUtils
{
#if !NETCOREAPP1_0 // FirstChanceException event was added in .NET Core 2.0
public static void AssertNoFirstChanceExceptions(Action action)
{
var firstChanceExceptions = new List<Exception>();
Expand Down Expand Up @@ -58,7 +57,6 @@ public static void AssertNoFirstChanceExceptions(Action action)
Assert.Fail(message.ToString());
}
}
#endif

public static string ConvertToEnvironmentLineEndings(this string value)
{
Expand Down
7 changes: 3 additions & 4 deletions src/Castle.Windsor/Castle.Windsor.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\buildscripts\common.props"></Import>
Expand All @@ -16,18 +16,17 @@
<NoWarn>$(NoWarn);NU5125</NoWarn> <!-- remove once tools are truly ready for NuGet's new 'license' element -->
<AssemblyName>Castle.Windsor</AssemblyName>
<RootNamespace>Castle</RootNamespace>
<Title>Castle Windsor</Title>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\..\buildscripts\CommonAssemblyInfo.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Castle.Core" Version="4.4.1" />
<PackageReference Include="Castle.Core" Version="[5.0.0,6.0)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net45'">
<ItemGroup Condition="'$(TargetFramework)'=='net462'">
<Reference Include="System.Configuration" />
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.Web" />
Expand Down

0 comments on commit 1973e70

Please sign in to comment.