Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit db4bbbf

Browse files
jkotassafern
authored andcommitted
Move files to shared CoreLib partition (dotnet/coreclr#10885)
Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
1 parent cd56cdd commit db4bbbf

31 files changed

+1749
-0
lines changed

src/Common/src/CoreLib/System.Private.CoreLib.Shared.projitems

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,11 +307,21 @@
307307
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\UnmanagedFunctionPointerAttribute.cs"/>
308308
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\UnmanagedType.cs"/>
309309
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\VarEnum.cs"/>
310+
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\IDeserializationCallback.cs"/>
310311
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\IFormatterConverter.cs"/>
311312
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\IObjectReference.cs"/>
312313
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\ISafeSerializationData.cs"/>
313314
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\ISerializable.cs"/>
315+
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\OnDeserializedAttribute.cs"/>
316+
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\OnDeserializingAttribute.cs"/>
317+
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\OnSerializedAttribute.cs"/>
318+
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\OnSerializingAttribute.cs"/>
319+
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\OptionalFieldAttribute.cs"/>
314320
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\SafeSerializationEventArgs.cs"/>
321+
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\SerializationException.cs"/>
322+
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\SerializationInfoEnumerator.cs"/>
323+
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\StreamingContext.cs"/>
324+
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Versioning\NonVersionableAttribute.cs"/>
315325
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Versioning\TargetFrameworkAttribute.cs"/>
316326
<Compile Include="$(MSBuildThisFileDirectory)System\Security\AllowPartiallyTrustedCallersAttribute.cs"/>
317327
<Compile Include="$(MSBuildThisFileDirectory)System\Security\CryptographicException.cs"/>
@@ -345,12 +355,32 @@
345355
<Compile Include="$(MSBuildThisFileDirectory)System\Text\UTF8Encoding.cs"/>
346356
<Compile Include="$(MSBuildThisFileDirectory)System\Text\UnicodeEncoding.cs"/>
347357
<Compile Include="$(MSBuildThisFileDirectory)System\ThreadAttributes.cs"/>
358+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\AbandonedMutexException.cs"/>
359+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ApartmentState.cs"/>
360+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\AsyncLocal.cs"/>
361+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\AutoResetEvent.cs"/>
348362
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\DeferredDisposableLifetime.cs"/>
363+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\EventResetMode.cs"/>
364+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ExecutionContext.cs"/>
365+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\LazyThreadSafetyMode.cs"/>
366+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\LockRecursionException.cs"/>
367+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ManualResetEvent.cs"/>
368+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ParameterizedThreadStart.cs"/>
369+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\SemaphoreFullException.cs"/>
370+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\SendOrPostCallback.cs"/>
371+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\SynchronizationLockException.cs"/>
349372
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\TaskCanceledException.cs"/>
350373
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\TaskExtensions.cs"/>
351374
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\TaskSchedulerException.cs"/>
352375
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadAbortException.cs"/>
376+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadPriority.cs"/>
377+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadStart.cs"/>
378+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadStartException.cs"/>
379+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadState.cs"/>
380+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadStateException.cs"/>
353381
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Timeout.cs"/>
382+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\TimeoutHelper.cs"/>
383+
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\WaitHandleCannotBeOpenedException.cs"/>
354384
<Compile Include="$(MSBuildThisFileDirectory)System\ThreadStaticAttribute.cs"/>
355385
<Compile Include="$(MSBuildThisFileDirectory)System\TimeoutException.cs"/>
356386
<Compile Include="$(MSBuildThisFileDirectory)System\TimeZone.cs"/>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
namespace System.Runtime.Serialization
6+
{
7+
public interface IDeserializationCallback
8+
{
9+
void OnDeserialization(object sender);
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
namespace System.Runtime.Serialization
6+
{
7+
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
8+
public sealed class OnDeserializedAttribute : Attribute
9+
{
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
namespace System.Runtime.Serialization
6+
{
7+
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
8+
public sealed class OnDeserializingAttribute : Attribute
9+
{
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
namespace System.Runtime.Serialization
6+
{
7+
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
8+
public sealed class OnSerializedAttribute : Attribute
9+
{
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
namespace System.Runtime.Serialization
6+
{
7+
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
8+
public sealed class OnSerializingAttribute : Attribute
9+
{
10+
}
11+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
namespace System.Runtime.Serialization
6+
{
7+
[AttributeUsage(AttributeTargets.Field, Inherited = false)]
8+
public sealed class OptionalFieldAttribute : Attribute
9+
{
10+
private int _versionAdded = 1;
11+
12+
public int VersionAdded
13+
{
14+
get { return _versionAdded; }
15+
set
16+
{
17+
if (value < 1)
18+
{
19+
throw new ArgumentException(SR.Serialization_OptionalFieldVersionValue);
20+
}
21+
_versionAdded = value;
22+
}
23+
}
24+
}
25+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System.Runtime.Serialization;
6+
7+
namespace System.Runtime.Serialization
8+
{
9+
[Serializable]
10+
public class SerializationException : SystemException
11+
{
12+
private static String s_nullMessage = SR.Arg_SerializationException;
13+
14+
// Creates a new SerializationException with its message
15+
// string set to a default message.
16+
public SerializationException()
17+
: base(s_nullMessage)
18+
{
19+
HResult = __HResults.COR_E_SERIALIZATION;
20+
}
21+
22+
public SerializationException(String message)
23+
: base(message)
24+
{
25+
HResult = __HResults.COR_E_SERIALIZATION;
26+
}
27+
28+
public SerializationException(String message, Exception innerException)
29+
: base(message, innerException)
30+
{
31+
HResult = __HResults.COR_E_SERIALIZATION;
32+
}
33+
34+
protected SerializationException(SerializationInfo info, StreamingContext context)
35+
: base(info, context)
36+
{
37+
}
38+
}
39+
}
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System.Collections;
6+
using System.Diagnostics;
7+
8+
namespace System.Runtime.Serialization
9+
{
10+
public struct SerializationEntry
11+
{
12+
private string _name;
13+
private object _value;
14+
private Type _type;
15+
16+
internal SerializationEntry(string entryName, object entryValue, Type entryType)
17+
{
18+
_name = entryName;
19+
_value = entryValue;
20+
_type = entryType;
21+
}
22+
23+
public object Value => _value;
24+
public string Name => _name;
25+
public Type ObjectType => _type;
26+
}
27+
28+
public sealed class SerializationInfoEnumerator : IEnumerator
29+
{
30+
private readonly string[] _members;
31+
private readonly object[] _data;
32+
private readonly Type[] _types;
33+
private readonly int _numItems;
34+
private int _currItem;
35+
private bool _current;
36+
37+
internal SerializationInfoEnumerator(string[] members, object[] info, Type[] types, int numItems)
38+
{
39+
Debug.Assert(members != null, "[SerializationInfoEnumerator.ctor]members!=null");
40+
Debug.Assert(info != null, "[SerializationInfoEnumerator.ctor]info!=null");
41+
Debug.Assert(types != null, "[SerializationInfoEnumerator.ctor]types!=null");
42+
Debug.Assert(numItems >= 0, "[SerializationInfoEnumerator.ctor]numItems>=0");
43+
Debug.Assert(members.Length >= numItems, "[SerializationInfoEnumerator.ctor]members.Length>=numItems");
44+
Debug.Assert(info.Length >= numItems, "[SerializationInfoEnumerator.ctor]info.Length>=numItems");
45+
Debug.Assert(types.Length >= numItems, "[SerializationInfoEnumerator.ctor]types.Length>=numItems");
46+
47+
_members = members;
48+
_data = info;
49+
_types = types;
50+
51+
//The MoveNext semantic is much easier if we enforce that [0..m_numItems] are valid entries
52+
//in the enumerator, hence we subtract 1.
53+
_numItems = numItems - 1;
54+
_currItem = -1;
55+
_current = false;
56+
}
57+
58+
public bool MoveNext()
59+
{
60+
if (_currItem < _numItems)
61+
{
62+
_currItem++;
63+
_current = true;
64+
}
65+
else
66+
{
67+
_current = false;
68+
}
69+
70+
return _current;
71+
}
72+
73+
object IEnumerator.Current => Current;
74+
75+
public SerializationEntry Current
76+
{
77+
get
78+
{
79+
if (_current == false)
80+
{
81+
throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
82+
}
83+
return new SerializationEntry(_members[_currItem], _data[_currItem], _types[_currItem]);
84+
}
85+
}
86+
87+
public void Reset()
88+
{
89+
_currItem = -1;
90+
_current = false;
91+
}
92+
93+
public string Name
94+
{
95+
get
96+
{
97+
if (_current == false)
98+
{
99+
throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
100+
}
101+
return _members[_currItem];
102+
}
103+
}
104+
public object Value
105+
{
106+
get
107+
{
108+
if (_current == false)
109+
{
110+
throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
111+
}
112+
return _data[_currItem];
113+
}
114+
}
115+
public Type ObjectType
116+
{
117+
get
118+
{
119+
if (_current == false)
120+
{
121+
throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
122+
}
123+
return _types[_currItem];
124+
}
125+
}
126+
}
127+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
namespace System.Runtime.Serialization
6+
{
7+
[Serializable]
8+
public struct StreamingContext
9+
{
10+
private readonly object _additionalContext;
11+
private readonly StreamingContextStates _state;
12+
13+
public StreamingContext(StreamingContextStates state) : this(state, null)
14+
{
15+
}
16+
17+
public StreamingContext(StreamingContextStates state, object additional)
18+
{
19+
_state = state;
20+
_additionalContext = additional;
21+
}
22+
23+
public override bool Equals(object obj)
24+
{
25+
if (!(obj is StreamingContext))
26+
{
27+
return false;
28+
}
29+
StreamingContext ctx = (StreamingContext)obj;
30+
return ctx._additionalContext == _additionalContext && ctx._state == _state;
31+
}
32+
33+
public override int GetHashCode() => (int)_state;
34+
35+
public StreamingContextStates State => _state;
36+
37+
public object Context => _additionalContext;
38+
}
39+
40+
[Flags]
41+
public enum StreamingContextStates
42+
{
43+
CrossProcess = 0x01,
44+
CrossMachine = 0x02,
45+
File = 0x04,
46+
Persistence = 0x08,
47+
Remoting = 0x10,
48+
Other = 0x20,
49+
Clone = 0x40,
50+
CrossAppDomain = 0x80,
51+
All = 0xFF,
52+
}
53+
}

0 commit comments

Comments
 (0)