From 8c65e3a739b82597ea8b5c6c7d22f30ddaad1a83 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Wed, 27 Apr 2022 21:21:10 -0700 Subject: [PATCH 1/2] remove CAS code --- .../ActivationContext/Overview/program.cs | 4 +-- .../UnhandledException/unhandledexception.cs | 2 -- .../Overview/customAppDomainManager.cs | 5 ---- .../System/ApplicationId/Overview/program.cs | 4 +-- .../System/Exception/.ctor/getobjdata.cs | 2 -- .../InitializeLifetimeService/source.cs | 3 --- .../MarshalByRefObject/Overview/source.cs | 4 +-- .../.ctor/typeloadexception_getobjectdata.cs | 3 --- .../UnhandledException/unhandledexception.fs | 4 +-- .../System/ApplicationId/Overview/program.fs | 4 +-- .../System/Exception/.ctor/getobjdata.fs | 1 - .../InitializeLifetimeService/source.fs | 3 +-- .../MarshalByRefObject/Overview/source.fs | 3 +-- xml/System/Activator.xml | 25 ++++--------------- 14 files changed, 13 insertions(+), 54 deletions(-) diff --git a/snippets/csharp/System/ActivationContext/Overview/program.cs b/snippets/csharp/System/ActivationContext/Overview/program.cs index 1da4bc7d8b3..cfb5ed29db7 100644 --- a/snippets/csharp/System/ActivationContext/Overview/program.cs +++ b/snippets/csharp/System/ActivationContext/Overview/program.cs @@ -5,13 +5,11 @@ using System.Security.Policy; using System.Reflection; using System.Security; -using System.Security.Permissions; namespace ActivationContextSample { public class Program : MarshalByRefObject { - [SecurityPermission(SecurityAction.LinkDemand, ControlDomainPolicy=true)] public static void Main(string[] args) { // @@ -25,7 +23,7 @@ public static void Main(string[] args) Console.Read(); } - [SecurityPermission(SecurityAction.LinkDemand, ControlDomainPolicy=true)] + public void Run() { Main(new string[] { }); diff --git a/snippets/csharp/System/AppDomain/UnhandledException/unhandledexception.cs b/snippets/csharp/System/AppDomain/UnhandledException/unhandledexception.cs index 8277db2be34..c6498978102 100644 --- a/snippets/csharp/System/AppDomain/UnhandledException/unhandledexception.cs +++ b/snippets/csharp/System/AppDomain/UnhandledException/unhandledexception.cs @@ -1,10 +1,8 @@ // using System; -using System.Security.Permissions; public class Example { - [SecurityPermission(SecurityAction.Demand, Flags=SecurityPermissionFlag.ControlAppDomain)] public static void Main() { AppDomain currentDomain = AppDomain.CurrentDomain; diff --git a/snippets/csharp/System/AppDomainManager/Overview/customAppDomainManager.cs b/snippets/csharp/System/AppDomainManager/Overview/customAppDomainManager.cs index 47cf23b1521..3e674f29c1b 100644 --- a/snippets/csharp/System/AppDomainManager/Overview/customAppDomainManager.cs +++ b/snippets/csharp/System/AppDomainManager/Overview/customAppDomainManager.cs @@ -11,7 +11,6 @@ using System.Net; using System.Reflection; using System.Security; -using System.Security.Permissions; using System.Security.Policy; using System.Security.Principal; using System.Threading; @@ -22,10 +21,6 @@ namespace MyNamespace { [GuidAttribute("F4D15099-3407-4A7E-A607-DEA440CF3891")] - [SecurityPermissionAttribute(SecurityAction.LinkDemand, - Flags = SecurityPermissionFlag.Infrastructure)] - [SecurityPermissionAttribute(SecurityAction.InheritanceDemand, - Flags = SecurityPermissionFlag.Infrastructure)] public class MyAppDomainManager : AppDomainManager { private HostSecurityManager mySecurityManager = null; diff --git a/snippets/csharp/System/ApplicationId/Overview/program.cs b/snippets/csharp/System/ApplicationId/Overview/program.cs index 8eef4f45886..5493c58269e 100644 --- a/snippets/csharp/System/ApplicationId/Overview/program.cs +++ b/snippets/csharp/System/ApplicationId/Overview/program.cs @@ -5,13 +5,11 @@ using System.Security.Policy; using System.Reflection; using System.Security; -using System.Security.Permissions; namespace ActivationContextSample { public class Program : MarshalByRefObject { - [SecurityPermission(SecurityAction.Demand, ControlDomainPolicy = true)] public static void Main(string[] args) { // @@ -57,4 +55,4 @@ public void Run() } } } -// \ No newline at end of file +// diff --git a/snippets/csharp/System/Exception/.ctor/getobjdata.cs b/snippets/csharp/System/Exception/.ctor/getobjdata.cs index da20b0394ee..df1a19ce46d 100644 --- a/snippets/csharp/System/Exception/.ctor/getobjdata.cs +++ b/snippets/csharp/System/Exception/.ctor/getobjdata.cs @@ -3,7 +3,6 @@ using System.IO; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Soap; -using System.Security.Permissions; // Define a serializable derived exception class. [Serializable()] @@ -24,7 +23,6 @@ protected SecondLevelException( SerializationInfo info, { } // GetObjectData performs a custom serialization. - [SecurityPermissionAttribute(SecurityAction.Demand,SerializationFormatter=true)] public override void GetObjectData( SerializationInfo info, StreamingContext context ) { diff --git a/snippets/csharp/System/MarshalByRefObject/InitializeLifetimeService/source.cs b/snippets/csharp/System/MarshalByRefObject/InitializeLifetimeService/source.cs index f83489cb116..b797acb760e 100644 --- a/snippets/csharp/System/MarshalByRefObject/InitializeLifetimeService/source.cs +++ b/snippets/csharp/System/MarshalByRefObject/InitializeLifetimeService/source.cs @@ -1,12 +1,9 @@ using System; using System.Runtime.Remoting.Lifetime; -using System.Security.Permissions; // public class MyClass : MarshalByRefObject { - [SecurityPermissionAttribute(SecurityAction.Demand, - Flags=SecurityPermissionFlag.Infrastructure)] public override Object InitializeLifetimeService() { ILease lease = (ILease)base.InitializeLifetimeService(); diff --git a/snippets/csharp/System/MarshalByRefObject/Overview/source.cs b/snippets/csharp/System/MarshalByRefObject/Overview/source.cs index 383c36c3781..c1415bfd997 100644 --- a/snippets/csharp/System/MarshalByRefObject/Overview/source.cs +++ b/snippets/csharp/System/MarshalByRefObject/Overview/source.cs @@ -1,14 +1,12 @@ // using System; using System.Runtime.Remoting; -using System.Security.Permissions; public class SetObjectUriForMarshalTest { class TestClass : MarshalByRefObject { } - [SecurityPermission(SecurityAction.Demand, Flags=SecurityPermissionFlag.RemotingConfiguration)] public static void Main() { TestClass obj = new TestClass(); @@ -19,4 +17,4 @@ public static void Main() { Console.WriteLine(RemotingServices.GetObjectUri(obj)); } } -// \ No newline at end of file +// diff --git a/snippets/csharp/System/TypeLoadException/.ctor/typeloadexception_getobjectdata.cs b/snippets/csharp/System/TypeLoadException/.ctor/typeloadexception_getobjectdata.cs index aa76048d6b6..d5a4877f315 100644 --- a/snippets/csharp/System/TypeLoadException/.ctor/typeloadexception_getobjectdata.cs +++ b/snippets/csharp/System/TypeLoadException/.ctor/typeloadexception_getobjectdata.cs @@ -15,7 +15,6 @@ serializes the exception data to a file and then reconstitutes the using System.Reflection; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Soap; -using System.Security.Permissions; using System.IO; class GetObjectDataDemo @@ -80,8 +79,6 @@ protected MyTypeLoadException(SerializationInfo sInfo, StreamingContext sContext _errorDateTime = sInfo.GetDateTime("ErrorDate"); } - // GetObjectData overrides must always have a demand for SerializationFormatter. - [SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter=true)] public override void GetObjectData(SerializationInfo sInfo, StreamingContext sContext) { base.GetObjectData(sInfo, sContext); diff --git a/snippets/fsharp/System/AppDomain/UnhandledException/unhandledexception.fs b/snippets/fsharp/System/AppDomain/UnhandledException/unhandledexception.fs index 83ff4b009db..b050bf48bf8 100644 --- a/snippets/fsharp/System/AppDomain/UnhandledException/unhandledexception.fs +++ b/snippets/fsharp/System/AppDomain/UnhandledException/unhandledexception.fs @@ -7,7 +7,7 @@ let myHandler _ (args: UnhandledExceptionEventArgs) = printfn $"MyHandler caught : {e.Message}" printfn $"Runtime terminating: {args.IsTerminating}" -[] +[] let main _ = let currentDomain = AppDomain.CurrentDomain currentDomain.UnhandledException.AddHandler(UnhandledExceptionEventHandler myHandler) @@ -27,4 +27,4 @@ let main _ = // // Unhandled Exception: System.Exception: 2 // at Example.main() -// \ No newline at end of file +// diff --git a/snippets/fsharp/System/ApplicationId/Overview/program.fs b/snippets/fsharp/System/ApplicationId/Overview/program.fs index 07775b9a76e..40e5ed8c3f2 100644 --- a/snippets/fsharp/System/ApplicationId/Overview/program.fs +++ b/snippets/fsharp/System/ApplicationId/Overview/program.fs @@ -5,9 +5,7 @@ open System.Text open System.Security.Policy open System.Reflection open System.Security -open System.Security.Permissions -[] let main _ = // printfn $"Full name = {AppDomain.CurrentDomain.ActivationContext.Identity.FullName}" @@ -40,4 +38,4 @@ let main _ = // // Console.Read() -// \ No newline at end of file +// diff --git a/snippets/fsharp/System/Exception/.ctor/getobjdata.fs b/snippets/fsharp/System/Exception/.ctor/getobjdata.fs index 39391993c25..2c3065f14d8 100644 --- a/snippets/fsharp/System/Exception/.ctor/getobjdata.fs +++ b/snippets/fsharp/System/Exception/.ctor/getobjdata.fs @@ -14,7 +14,6 @@ open System.Security.Permissions interface ISerializable with // GetObjectData performs a custom serialization. - [] member this.GetObjectData(info: SerializationInfo, context: StreamingContext) = // Change the case of two properties, and then use the // method of the base class. diff --git a/snippets/fsharp/System/MarshalByRefObject/InitializeLifetimeService/source.fs b/snippets/fsharp/System/MarshalByRefObject/InitializeLifetimeService/source.fs index d8d51947a51..ec1648948cc 100644 --- a/snippets/fsharp/System/MarshalByRefObject/InitializeLifetimeService/source.fs +++ b/snippets/fsharp/System/MarshalByRefObject/InitializeLifetimeService/source.fs @@ -6,7 +6,6 @@ open System.Security.Permissions type MyClass() = inherit MarshalByRefObject() - [] override _.InitializeLifetimeService() = let lease = base.InitializeLifetimeService() :?> ILease if lease.CurrentState = LeaseState.Initial then @@ -14,4 +13,4 @@ type MyClass() = lease.SponsorshipTimeout <- TimeSpan.FromMinutes 2 lease.RenewOnCallTime <- TimeSpan.FromSeconds 2 lease -// \ No newline at end of file +// diff --git a/snippets/fsharp/System/MarshalByRefObject/Overview/source.fs b/snippets/fsharp/System/MarshalByRefObject/Overview/source.fs index 368e096d1a6..4362a5054f7 100644 --- a/snippets/fsharp/System/MarshalByRefObject/Overview/source.fs +++ b/snippets/fsharp/System/MarshalByRefObject/Overview/source.fs @@ -6,7 +6,6 @@ open System.Security.Permissions type TestClass() = inherit MarshalByRefObject() -[] [] let main _ = let obj = TestClass() @@ -16,4 +15,4 @@ let main _ = printfn $"{RemotingServices.GetObjectUri obj}" 0 -// \ No newline at end of file +// diff --git a/xml/System/Activator.xml b/xml/System/Activator.xml index 6b8ff887783..bf312533d97 100644 --- a/xml/System/Activator.xml +++ b/xml/System/Activator.xml @@ -906,10 +906,7 @@ Note: In .NET for Win Use when a host needs to execute code in an application domain that has restricted security permissions. - Use to unwrap the return value. - -> [!NOTE] -> This method uses to require the immediate caller to have full trust. + Use to unwrap the return value. ]]> @@ -1554,10 +1551,7 @@ Note: In .NET for Win The method returns `null` for the instances with no value. - Use to unwrap the return value. - -> [!NOTE] -> This method uses to require the immediate caller to have full trust. + Use to unwrap the return value. ]]> @@ -1769,10 +1763,7 @@ Note: In .NET for Win Use when a host needs to execute code in an application domain that has restricted security permissions. - Use to unwrap the return value. - -> [!NOTE] -> This method uses to require the immediate caller to have full trust. + Use to unwrap the return value. ]]> @@ -2032,10 +2023,7 @@ Note: In .NET for Win ## Remarks Use when a host needs to execute code in an application domain that has restricted security permissions. - Use the method to unwrap the return value. - -> [!NOTE] -> This method uses to require the immediate caller to have full trust. + Use the method to unwrap the return value. For information about other exceptions that can be thrown by invoked methods, see the Exceptions section of the and methods. @@ -2474,10 +2462,7 @@ Note: In .NET for Win ## Remarks Use when a host needs to execute code in an application domain that has restricted security permissions. - Use the method to unwrap the return value. - -> [!NOTE] -> This method uses to require the immediate caller to have full trust. + Use the method to unwrap the return value. For information about other exceptions that can be thrown by invoked methods, see the Exceptions section of the and methods. From c13a0992613ee108820812bf20757e5483eee781 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Thu, 28 Apr 2022 16:45:43 -0700 Subject: [PATCH 2/2] add project files --- .../ActivationContext/Overview/Project.csproj | 6 + .../ActivationContext/Overview/program.cs | 7 +- .../AppDomainManager/Overview/Project.csproj | 6 + .../ApplicationId/Overview/Project.csproj | 6 + .../System/Exception/.ctor/Project.csproj | 9 + .../System/Exception/.ctor/getobjdata.cs | 238 +++++++++--------- .../csharp/System/Exception/.ctor/news.cs | 2 +- .../InitializeLifetimeService/Project.csproj | 9 + .../Overview/Project.csproj | 9 + .../TypeLoadException/.ctor/Project.csproj | 9 + .../.ctor/typeloadexception_constructor3.cs | 4 +- 11 files changed, 177 insertions(+), 128 deletions(-) create mode 100644 snippets/csharp/System/ActivationContext/Overview/Project.csproj create mode 100644 snippets/csharp/System/AppDomainManager/Overview/Project.csproj create mode 100644 snippets/csharp/System/ApplicationId/Overview/Project.csproj create mode 100644 snippets/csharp/System/Exception/.ctor/Project.csproj create mode 100644 snippets/csharp/System/MarshalByRefObject/InitializeLifetimeService/Project.csproj create mode 100644 snippets/csharp/System/MarshalByRefObject/Overview/Project.csproj create mode 100644 snippets/csharp/System/TypeLoadException/.ctor/Project.csproj diff --git a/snippets/csharp/System/ActivationContext/Overview/Project.csproj b/snippets/csharp/System/ActivationContext/Overview/Project.csproj new file mode 100644 index 00000000000..e94f2e1423b --- /dev/null +++ b/snippets/csharp/System/ActivationContext/Overview/Project.csproj @@ -0,0 +1,6 @@ + + + Library + net4.8 + + diff --git a/snippets/csharp/System/ActivationContext/Overview/program.cs b/snippets/csharp/System/ActivationContext/Overview/program.cs index cfb5ed29db7..7556df94652 100644 --- a/snippets/csharp/System/ActivationContext/Overview/program.cs +++ b/snippets/csharp/System/ActivationContext/Overview/program.cs @@ -1,10 +1,5 @@ // using System; -using System.Collections; -using System.Text; -using System.Security.Policy; -using System.Reflection; -using System.Security; namespace ActivationContextSample { @@ -23,7 +18,7 @@ public static void Main(string[] args) Console.Read(); } - + public void Run() { Main(new string[] { }); diff --git a/snippets/csharp/System/AppDomainManager/Overview/Project.csproj b/snippets/csharp/System/AppDomainManager/Overview/Project.csproj new file mode 100644 index 00000000000..e94f2e1423b --- /dev/null +++ b/snippets/csharp/System/AppDomainManager/Overview/Project.csproj @@ -0,0 +1,6 @@ + + + Library + net4.8 + + diff --git a/snippets/csharp/System/ApplicationId/Overview/Project.csproj b/snippets/csharp/System/ApplicationId/Overview/Project.csproj new file mode 100644 index 00000000000..e94f2e1423b --- /dev/null +++ b/snippets/csharp/System/ApplicationId/Overview/Project.csproj @@ -0,0 +1,6 @@ + + + Library + net4.8 + + diff --git a/snippets/csharp/System/Exception/.ctor/Project.csproj b/snippets/csharp/System/Exception/.ctor/Project.csproj new file mode 100644 index 00000000000..a567cba7522 --- /dev/null +++ b/snippets/csharp/System/Exception/.ctor/Project.csproj @@ -0,0 +1,9 @@ + + + Library + net4.8 + + + + + diff --git a/snippets/csharp/System/Exception/.ctor/getobjdata.cs b/snippets/csharp/System/Exception/.ctor/getobjdata.cs index df1a19ce46d..17ed2a475af 100644 --- a/snippets/csharp/System/Exception/.ctor/getobjdata.cs +++ b/snippets/csharp/System/Exception/.ctor/getobjdata.cs @@ -4,125 +4,125 @@ using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Soap; - // Define a serializable derived exception class. - [Serializable()] - class SecondLevelException : Exception, ISerializable - { - // This public constructor is used by class instantiators. - public SecondLevelException( string message, Exception inner ) : - base( message, inner ) - { - HelpLink = "http://MSDN.Microsoft.com"; - Source = "Exception_Class_Samples"; - } - - // This protected constructor is used for deserialization. - protected SecondLevelException( SerializationInfo info, - StreamingContext context ) : - base( info, context ) - { } - - // GetObjectData performs a custom serialization. - public override void GetObjectData( SerializationInfo info, - StreamingContext context ) - { - // Change the case of two properties, and then use the - // method of the base class. - HelpLink = HelpLink.ToLower( ); - Source = Source.ToUpperInvariant(); - - base.GetObjectData( info, context ); - } - } - - class SerializationDemo - { - public static void Main() - { - Console.WriteLine( - "This example of the Exception constructor " + - "and Exception.GetObjectData\nwith Serialization" + - "Info and StreamingContext parameters " + - "generates \nthe following output.\n" ); - - try - { - // This code forces a division by 0 and catches the - // resulting exception. - try - { - int zero = 0; - int ecks = 1 / zero; - } - catch( Exception ex ) - { - // Create a new exception to throw again. - SecondLevelException newExcept = - new SecondLevelException( - "Forced a division by 0 and threw " + - "another exception.", ex ); - - Console.WriteLine( - "Forced a division by 0, caught the " + - "resulting exception, \n" + - "and created a derived exception:\n" ); - Console.WriteLine( "HelpLink: {0}", - newExcept.HelpLink ); - Console.WriteLine( "Source: {0}", - newExcept.Source ); - - // This FileStream is used for the serialization. - FileStream stream = - new FileStream( "NewException.dat", - FileMode.Create ); - - try - { - // Serialize the derived exception. - SoapFormatter formatter = - new SoapFormatter( null, - new StreamingContext( - StreamingContextStates.File ) ); - formatter.Serialize( stream, newExcept ); - - // Rewind the stream and deserialize the - // exception. - stream.Position = 0; - SecondLevelException deserExcept = - (SecondLevelException) - formatter.Deserialize( stream ); - - Console.WriteLine( - "\nSerialized the exception, and then " + - "deserialized the resulting stream " + - "into a \nnew exception. " + - "The deserialization changed the case " + - "of certain properties:\n" ); - - // Throw the deserialized exception again. - throw deserExcept; - } - catch( SerializationException se ) - { - Console.WriteLine( "Failed to serialize: {0}", - se.ToString( ) ); - } - finally - { - stream.Close( ); - } - } - } - catch( Exception ex ) - { - Console.WriteLine( "HelpLink: {0}", ex.HelpLink ); - Console.WriteLine( "Source: {0}", ex.Source ); - - Console.WriteLine( ); - Console.WriteLine( ex.ToString( ) ); - } - } - } +// Define a serializable derived exception class. +[Serializable()] +class SecondLevelException : Exception, ISerializable +{ + // This public constructor is used by class instantiators. + public SecondLevelException(string message, Exception inner) : + base(message, inner) + { + HelpLink = "http://MSDN.Microsoft.com"; + Source = "Exception_Class_Samples"; + } + + // This protected constructor is used for deserialization. + protected SecondLevelException(SerializationInfo info, + StreamingContext context) : + base(info, context) + { } + + // GetObjectData performs a custom serialization. + public override void GetObjectData(SerializationInfo info, + StreamingContext context) + { + // Change the case of two properties, and then use the + // method of the base class. + HelpLink = HelpLink.ToLower(); + Source = Source.ToUpperInvariant(); + + base.GetObjectData(info, context); + } +} + +class SerializationDemo +{ + public static void Main() + { + Console.WriteLine( + "This example of the Exception constructor " + + "and Exception.GetObjectData\nwith Serialization" + + "Info and StreamingContext parameters " + + "generates \nthe following output.\n"); + + try + { + // This code forces a division by 0 and catches the + // resulting exception. + try + { + int zero = 0; + int ecks = 1 / zero; + } + catch (Exception ex) + { + // Create a new exception to throw again. + SecondLevelException newExcept = + new SecondLevelException( + "Forced a division by 0 and threw " + + "another exception.", ex); + + Console.WriteLine( + "Forced a division by 0, caught the " + + "resulting exception, \n" + + "and created a derived exception:\n"); + Console.WriteLine("HelpLink: {0}", + newExcept.HelpLink); + Console.WriteLine("Source: {0}", + newExcept.Source); + + // This FileStream is used for the serialization. + FileStream stream = + new FileStream("NewException.dat", + FileMode.Create); + + try + { + // Serialize the derived exception. + SoapFormatter formatter = + new SoapFormatter(null, + new StreamingContext( + StreamingContextStates.File)); + formatter.Serialize(stream, newExcept); + + // Rewind the stream and deserialize the + // exception. + stream.Position = 0; + SecondLevelException deserExcept = + (SecondLevelException) + formatter.Deserialize(stream); + + Console.WriteLine( + "\nSerialized the exception, and then " + + "deserialized the resulting stream " + + "into a \nnew exception. " + + "The deserialization changed the case " + + "of certain properties:\n"); + + // Throw the deserialized exception again. + throw deserExcept; + } + catch (SerializationException se) + { + Console.WriteLine("Failed to serialize: {0}", + se.ToString()); + } + finally + { + stream.Close(); + } + } + } + catch (Exception ex) + { + Console.WriteLine("HelpLink: {0}", ex.HelpLink); + Console.WriteLine("Source: {0}", ex.Source); + + Console.WriteLine(); + Console.WriteLine(ex.ToString()); + } + } +} /* This example displays the following output. diff --git a/snippets/csharp/System/Exception/.ctor/news.cs b/snippets/csharp/System/Exception/.ctor/news.cs index 02e471adc3e..4630ae15843 100644 --- a/snippets/csharp/System/Exception/.ctor/news.cs +++ b/snippets/csharp/System/Exception/.ctor/news.cs @@ -2,7 +2,7 @@ // Example for the Exception( string ) constructor. using System; -namespace NDP_UE_CS +namespace NDP_UE_CS2 { // Derive an exception with a specifiable message. class NotEvenException : Exception diff --git a/snippets/csharp/System/MarshalByRefObject/InitializeLifetimeService/Project.csproj b/snippets/csharp/System/MarshalByRefObject/InitializeLifetimeService/Project.csproj new file mode 100644 index 00000000000..a567cba7522 --- /dev/null +++ b/snippets/csharp/System/MarshalByRefObject/InitializeLifetimeService/Project.csproj @@ -0,0 +1,9 @@ + + + Library + net4.8 + + + + + diff --git a/snippets/csharp/System/MarshalByRefObject/Overview/Project.csproj b/snippets/csharp/System/MarshalByRefObject/Overview/Project.csproj new file mode 100644 index 00000000000..a567cba7522 --- /dev/null +++ b/snippets/csharp/System/MarshalByRefObject/Overview/Project.csproj @@ -0,0 +1,9 @@ + + + Library + net4.8 + + + + + diff --git a/snippets/csharp/System/TypeLoadException/.ctor/Project.csproj b/snippets/csharp/System/TypeLoadException/.ctor/Project.csproj new file mode 100644 index 00000000000..a567cba7522 --- /dev/null +++ b/snippets/csharp/System/TypeLoadException/.ctor/Project.csproj @@ -0,0 +1,9 @@ + + + Library + net4.8 + + + + + diff --git a/snippets/csharp/System/TypeLoadException/.ctor/typeloadexception_constructor3.cs b/snippets/csharp/System/TypeLoadException/.ctor/typeloadexception_constructor3.cs index e0496f933f8..155bd4cba34 100644 --- a/snippets/csharp/System/TypeLoadException/.ctor/typeloadexception_constructor3.cs +++ b/snippets/csharp/System/TypeLoadException/.ctor/typeloadexception_constructor3.cs @@ -18,7 +18,7 @@ public static void Main() Console.WriteLine("Calling a method in a non-existent DLL which triggers a TypeLoadException."); try { - TypeLoadExceptionDemoClass.GenerateException(); + TypeLoadExceptionDemoClass3.GenerateException(); } catch (TypeLoadException e) { @@ -32,7 +32,7 @@ public static void Main() } } -class TypeLoadExceptionDemoClass +class TypeLoadExceptionDemoClass3 { // A call to this method will raise a TypeLoadException. [DllImport("NonExistentDLL.DLL", EntryPoint="MethodNotExists")]