Skip to content

Commit f7a31df

Browse files
authored
Add option to remove AppDomains APIs with compiler constant (#28)
1 parent 3c23f49 commit f7a31df

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

source/CoreLibrary.nfproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<OutputName>mscorlib</OutputName>
2222
<IsCoreAssembly>true</IsCoreAssembly>
2323
<IsMscorlib>true</IsMscorlib>
24+
<DefineConstants>$(DefineConstants);NANOCLR_APPDOMAINS</DefineConstants>
2425
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
2526
<DocumentationFile>bin\$(Configuration)\mscorlib.xml</DocumentationFile>
2627
</PropertyGroup>

source/System/AppDomain.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
// See LICENSE file in the project root for full license information.
55
//
66

7+
///////////////////////////////////////////////////
8+
// DEV NOTE: to enable the AppDomain API add //
9+
// 'NANOCLR_APPDOMAINS' to the compile constants //
10+
///////////////////////////////////////////////////
11+
#if (NANOCLR_APPDOMAINS)
12+
713
using System.Reflection;
814
using System.Threading;
915
using System.Runtime.CompilerServices;
@@ -113,3 +119,4 @@ public Assembly Load(String assemblyString)
113119
public static extern void Unload(AppDomain domain);
114120
}
115121
}
122+
#endif // #if (NANOCLR_APPDOMAINS)

source/System/Threading/Thread.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,16 @@ public extern ThreadState ThreadState
168168
get;
169169
}
170170

171+
#if (NANOCLR_APPDOMAINS)
172+
171173
/// <summary>
172174
/// Returns the current domain in which the current thread is running.
173175
/// </summary>
174176
/// <returns>An AppDomain representing the current application domain of the running thread.</returns>
175177
[MethodImpl(MethodImplOptions.InternalCall)]
176178
public static extern AppDomain GetDomain();
179+
180+
#endif // #if (NANOCLR_APPDOMAINS)
181+
177182
}
178183
}

0 commit comments

Comments
 (0)