Skip to content

Commit 3ababc2

Browse files
authored
Delete dead code (dotnet#11431)
1 parent 278837e commit 3ababc2

32 files changed

+0
-786
lines changed

src/mscorlib/System.Private.CoreLib.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,7 @@
344344
<Compile Include="$(BclSourcesRoot)\System\MissingMemberException.cs" />
345345
<Compile Include="$(BclSourcesRoot)\System\NonSerializedAttribute.cs" />
346346
<Compile Include="$(BclSourcesRoot)\System\Number.cs" />
347-
<Compile Include="$(BclSourcesRoot)\System\OperatingSystem.cs" />
348347
<Compile Include="$(BclSourcesRoot)\System\ParseNumbers.cs" />
349-
<Compile Include="$(BclSourcesRoot)\System\PlatformID.cs" />
350348
<Compile Include="$(BclSourcesRoot)\System\ResId.cs" />
351349
<Compile Include="$(BclSourcesRoot)\System\RtType.cs" />
352350
<Compile Include="$(BclSourcesRoot)\System\RuntimeArgumentHandle.cs" />
@@ -591,9 +589,6 @@
591589
<Compile Include="$(BclSourcesRoot)\System\Runtime\Serialization\FormatterServices.cs" />
592590
<Compile Include="$(BclSourcesRoot)\System\Runtime\Serialization\SerializationInfo.cs" />
593591
</ItemGroup>
594-
<ItemGroup>
595-
<Compile Include="$(BclSourcesRoot)\System\Runtime\Remoting\ObjectHandle.cs" />
596-
</ItemGroup>
597592
<ItemGroup>
598593
<Compile Include="$(BclSourcesRoot)\System\Text\DecoderNLS.cs" />
599594
<Compile Include="$(BclSourcesRoot)\System\Text\DecoderBestFitFallback.cs" />

src/mscorlib/src/Microsoft/Win32/Win32Native.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ namespace Microsoft.Win32
9393
using System.Security;
9494
using System.Text;
9595
using System.Configuration.Assemblies;
96-
using System.Runtime.Remoting;
9796
using System.Runtime.InteropServices;
9897
using System.Threading;
9998
using Microsoft.Win32.SafeHandles;

src/mscorlib/src/System/Activator.cs

Lines changed: 0 additions & 258 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ namespace System
1616
{
1717
using System;
1818
using System.Reflection;
19-
using System.Runtime.Remoting;
2019
using System.Security;
2120
using CultureInfo = System.Globalization.CultureInfo;
2221
using Evidence = System.Security.Policy.Evidence;
@@ -113,47 +112,6 @@ static public Object CreateInstance(Type type)
113112
return Activator.CreateInstance(type, false);
114113
}
115114

116-
/*
117-
* Create an instance using the name of type and the assembly where it exists. This allows
118-
* types to be created remotely without having to load the type locally.
119-
*/
120-
121-
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
122-
static public ObjectHandle CreateInstance(String assemblyName,
123-
String typeName)
124-
{
125-
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
126-
return CreateInstance(assemblyName,
127-
typeName,
128-
false,
129-
Activator.ConstructorDefault,
130-
null,
131-
null,
132-
null,
133-
null,
134-
null,
135-
ref stackMark);
136-
}
137-
138-
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
139-
static public ObjectHandle CreateInstance(String assemblyName,
140-
String typeName,
141-
Object[] activationAttributes)
142-
143-
{
144-
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
145-
return CreateInstance(assemblyName,
146-
typeName,
147-
false,
148-
Activator.ConstructorDefault,
149-
null,
150-
null,
151-
null,
152-
activationAttributes,
153-
null,
154-
ref stackMark);
155-
}
156-
157115
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
158116
static public Object CreateInstance(Type type, bool nonPublic)
159117
{
@@ -185,221 +143,5 @@ static public T CreateInstance<T>()
185143
// Skip the CreateInstanceCheckThis call to avoid perf cost and to maintain compatibility with V2 (throwing the same exceptions).
186144
return (T)rt.CreateInstanceDefaultCtor(true /*publicOnly*/, true /*skipCheckThis*/, true /*fillCache*/, ref stackMark);
187145
}
188-
189-
static public ObjectHandle CreateInstanceFrom(String assemblyFile,
190-
String typeName)
191-
192-
{
193-
return CreateInstanceFrom(assemblyFile, typeName, null);
194-
}
195-
196-
static public ObjectHandle CreateInstanceFrom(String assemblyFile,
197-
String typeName,
198-
Object[] activationAttributes)
199-
200-
{
201-
return CreateInstanceFrom(assemblyFile,
202-
typeName,
203-
false,
204-
Activator.ConstructorDefault,
205-
null,
206-
null,
207-
null,
208-
activationAttributes);
209-
}
210-
211-
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
212-
public static ObjectHandle CreateInstance(string assemblyName,
213-
string typeName,
214-
bool ignoreCase,
215-
BindingFlags bindingAttr,
216-
Binder binder,
217-
object[] args,
218-
CultureInfo culture,
219-
object[] activationAttributes)
220-
{
221-
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
222-
return CreateInstance(assemblyName,
223-
typeName,
224-
ignoreCase,
225-
bindingAttr,
226-
binder,
227-
args,
228-
culture,
229-
activationAttributes,
230-
null,
231-
ref stackMark);
232-
}
233-
234-
static internal ObjectHandle CreateInstance(String assemblyString,
235-
String typeName,
236-
bool ignoreCase,
237-
BindingFlags bindingAttr,
238-
Binder binder,
239-
Object[] args,
240-
CultureInfo culture,
241-
Object[] activationAttributes,
242-
Evidence securityInfo,
243-
ref StackCrawlMark stackMark)
244-
{
245-
Type type = null;
246-
Assembly assembly = null;
247-
if (assemblyString == null)
248-
{
249-
assembly = RuntimeAssembly.GetExecutingAssembly(ref stackMark);
250-
}
251-
else
252-
{
253-
RuntimeAssembly assemblyFromResolveEvent;
254-
AssemblyName assemblyName = RuntimeAssembly.CreateAssemblyName(assemblyString, false /*forIntrospection*/, out assemblyFromResolveEvent);
255-
if (assemblyFromResolveEvent != null)
256-
{
257-
// Assembly was resolved via AssemblyResolve event
258-
assembly = assemblyFromResolveEvent;
259-
}
260-
else if (assemblyName.ContentType == AssemblyContentType.WindowsRuntime)
261-
{
262-
// WinRT type - we have to use Type.GetType
263-
type = Type.GetType(typeName + ", " + assemblyString, true /*throwOnError*/, ignoreCase);
264-
}
265-
else
266-
{
267-
// Classic managed type
268-
assembly = RuntimeAssembly.InternalLoadAssemblyName(
269-
assemblyName, securityInfo, null, ref stackMark,
270-
true /*thrownOnFileNotFound*/, false /*forIntrospection*/);
271-
}
272-
}
273-
274-
if (type == null)
275-
{
276-
// It's classic managed type (not WinRT type)
277-
Log(assembly != null, "CreateInstance:: ", "Loaded " + assembly.FullName, "Failed to Load: " + assemblyString);
278-
if (assembly == null) return null;
279-
280-
type = assembly.GetType(typeName, true /*throwOnError*/, ignoreCase);
281-
}
282-
283-
Object o = Activator.CreateInstance(type,
284-
bindingAttr,
285-
binder,
286-
args,
287-
culture,
288-
activationAttributes);
289-
290-
Log(o != null, "CreateInstance:: ", "Created Instance of class " + typeName, "Failed to create instance of class " + typeName);
291-
if (o == null)
292-
return null;
293-
else
294-
{
295-
ObjectHandle Handle = new ObjectHandle(o);
296-
return Handle;
297-
}
298-
}
299-
300-
public static ObjectHandle CreateInstanceFrom(string assemblyFile,
301-
string typeName,
302-
bool ignoreCase,
303-
BindingFlags bindingAttr,
304-
Binder binder,
305-
object[] args,
306-
CultureInfo culture,
307-
object[] activationAttributes)
308-
{
309-
return CreateInstanceFromInternal(assemblyFile,
310-
typeName,
311-
ignoreCase,
312-
bindingAttr,
313-
binder,
314-
args,
315-
culture,
316-
activationAttributes,
317-
null);
318-
}
319-
320-
private static ObjectHandle CreateInstanceFromInternal(String assemblyFile,
321-
String typeName,
322-
bool ignoreCase,
323-
BindingFlags bindingAttr,
324-
Binder binder,
325-
Object[] args,
326-
CultureInfo culture,
327-
Object[] activationAttributes,
328-
Evidence securityInfo)
329-
{
330-
#pragma warning disable 618
331-
Assembly assembly = Assembly.LoadFrom(assemblyFile, securityInfo);
332-
#pragma warning restore 618
333-
Type t = assembly.GetType(typeName, true, ignoreCase);
334-
335-
Object o = Activator.CreateInstance(t,
336-
bindingAttr,
337-
binder,
338-
args,
339-
culture,
340-
activationAttributes);
341-
342-
Log(o != null, "CreateInstanceFrom:: ", "Created Instance of class " + typeName, "Failed to create instance of class " + typeName);
343-
if (o == null)
344-
return null;
345-
else
346-
{
347-
ObjectHandle Handle = new ObjectHandle(o);
348-
return Handle;
349-
}
350-
}
351-
352-
public static ObjectHandle CreateComInstanceFrom(String assemblyName,
353-
String typeName)
354-
{
355-
return CreateComInstanceFrom(assemblyName,
356-
typeName,
357-
null,
358-
AssemblyHashAlgorithm.None);
359-
}
360-
361-
public static ObjectHandle CreateComInstanceFrom(String assemblyName,
362-
String typeName,
363-
byte[] hashValue,
364-
AssemblyHashAlgorithm hashAlgorithm)
365-
{
366-
Assembly assembly = Assembly.LoadFrom(assemblyName, hashValue, hashAlgorithm);
367-
368-
Type t = assembly.GetType(typeName, true, false);
369-
370-
Object[] Attr = t.GetCustomAttributes(typeof(ComVisibleAttribute), false);
371-
if (Attr.Length > 0)
372-
{
373-
if (((ComVisibleAttribute)Attr[0]).Value == false)
374-
throw new TypeLoadException(SR.Argument_TypeMustBeVisibleFromCom);
375-
}
376-
377-
Log(assembly != null, "CreateInstance:: ", "Loaded " + assembly.FullName, "Failed to Load: " + assemblyName);
378-
379-
if (assembly == null) return null;
380-
381-
382-
Object o = Activator.CreateInstance(t,
383-
Activator.ConstructorDefault,
384-
null,
385-
null,
386-
null,
387-
null);
388-
389-
Log(o != null, "CreateInstance:: ", "Created Instance of class " + typeName, "Failed to create instance of class " + typeName);
390-
if (o == null)
391-
return null;
392-
else
393-
{
394-
ObjectHandle Handle = new ObjectHandle(o);
395-
return Handle;
396-
}
397-
}
398-
399-
[System.Diagnostics.Conditional("_DEBUG")]
400-
private static void Log(bool test, string title, string success, string failure)
401-
{
402-
}
403146
}
404147
}
405-

0 commit comments

Comments
 (0)