diff --git a/src/Spring/Spring.Core/Util/ReflectionUtils.cs b/src/Spring/Spring.Core/Util/ReflectionUtils.cs index e73d1997..906bbe74 100644 --- a/src/Spring/Spring.Core/Util/ReflectionUtils.cs +++ b/src/Spring/Spring.Core/Util/ReflectionUtils.cs @@ -1,19 +1,19 @@ #region License -/* - * Copyright © 2002-2005 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* + * Copyright © 2002-2005 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #endregion @@ -977,13 +977,13 @@ namespace Spring.Util { // In case of no match, throw noMatchingProperty = true; - /* - throw new InvalidOperationException( - String.Format(CultureInfo.InvariantCulture, - "The property with name {0} can't be found in the " + - "type {1}, but is present as a named property " + - "on the attributeData {2}", namedArgument.MemberInfo.Name, - attributeType.FullName, attributeData)); + /* + throw new InvalidOperationException( + String.Format(CultureInfo.InvariantCulture, + "The property with name {0} can't be found in the " + + "type {1}, but is present as a named property " + + "on the attributeData {2}", namedArgument.MemberInfo.Name, + attributeType.FullName, attributeData)); */ } } @@ -1154,9 +1154,9 @@ namespace Spring.Util #if NET_2_0 private static readonly MethodInfo Exception_InternalPreserveStackTrace = typeof(Exception).GetMethod("InternalPreserveStackTrace", BindingFlags.Instance | BindingFlags.NonPublic); -#else - private static readonly FieldInfo Exception_RemoteStackTraceString = - typeof(Exception).GetField("_remoteStackTraceString", BindingFlags.Instance | BindingFlags.NonPublic); +#else + private static readonly FieldInfo Exception_RemoteStackTraceString = + typeof(Exception).GetField("_remoteStackTraceString", BindingFlags.Instance | BindingFlags.NonPublic); #endif /// @@ -1175,8 +1175,8 @@ namespace Spring.Util return ex.InnerException; } Exception_InternalPreserveStackTrace.Invoke(ex.InnerException, new Object[] { }); -#else - Exception_RemoteStackTraceString.SetValue(ex.InnerException, ex.InnerException.StackTrace + Environment.NewLine); +#else + Exception_RemoteStackTraceString.SetValue(ex.InnerException, ex.InnerException.StackTrace + Environment.NewLine); #endif return ex.InnerException; } @@ -1221,18 +1221,18 @@ namespace Spring.Util object[] attrs = type.Assembly.GetCustomAttributes(typeof(InternalsVisibleToAttribute), false); foreach (InternalsVisibleToAttribute ivta in attrs) { - if (ivta.AssemblyName == friendlyAssemblyName) + if (ivta.AssemblyName.Split(',')[0] == friendlyAssemblyName) { return true; } } } } -#else - if (type.IsPublic || (type.IsNestedPublic && type.DeclaringType.IsPublic)) - { - return true; - } +#else + if (type.IsPublic || (type.IsNestedPublic && type.DeclaringType.IsPublic)) + { + return true; + } #endif return false; } @@ -1378,16 +1378,16 @@ namespace Spring.Util } return handler; } -#else - private static void MemberwiseCopyInternal(object fromObject, object toObject, Type smallerType) - { - FieldInfo[] fields = GetFields(smallerType); - for (int i = 0; i < fields.Length; i++) - { - FieldInfo field = fields[i]; - field.SetValue(toObject, field.GetValue(fromObject)); - } - } +#else + private static void MemberwiseCopyInternal(object fromObject, object toObject, Type smallerType) + { + FieldInfo[] fields = GetFields(smallerType); + for (int i = 0; i < fields.Length; i++) + { + FieldInfo field = fields[i]; + field.SetValue(toObject, field.GetValue(fromObject)); + } + } #endif #region Field Cache Management for "MemberwiseCopy" diff --git a/test/Spring/Spring.Core.Tests/Util/ReflectionUtilsTests.cs b/test/Spring/Spring.Core.Tests/Util/ReflectionUtilsTests.cs index 9e2b9a55..35942bfd 100644 --- a/test/Spring/Spring.Core.Tests/Util/ReflectionUtilsTests.cs +++ b/test/Spring/Spring.Core.Tests/Util/ReflectionUtilsTests.cs @@ -888,7 +888,7 @@ namespace Spring.Util } #if NET_2_0 - private static readonly string FRIENDLY_ASSEMBLY_NAME = "ReflectionUtils.IsTypeVisible.AssemblyTestName, PublicKey=001200000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293"; + private static readonly string FRIENDLY_ASSEMBLY_NAME = "ReflectionUtils.IsTypeVisible.AssemblyTestName"; [Test] public void IsTypeVisibleFromFriendlyAssemblyWithInternalType()