Skip to content

Commit a6a9adb

Browse files
committed
Netstandard 2.0 improvements + fixes
1 parent 2e5e716 commit a6a9adb

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

src/Exceptionless/Dependency/TinyIoC.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4245,7 +4245,7 @@ public static Assembly Assembly(this Type type)
42454245
}
42464246
#endif
42474247
// reverse shim for WinRT SR changes...
4248-
#if (!NETFX_CORE && !PORTABLE && !NETSTANDARD1_0 && !NETSTANDARD1_1 && !NETSTANDARD1_2 && !NETSTANDARD1_3 && !NETSTANDARD1_4 && !NETSTANDARD1_5 || NETSTANDARD1_6)
4248+
#if (!NETFX_CORE && !PORTABLE && !NETSTANDARD1_0 && !NETSTANDARD1_1 && !NETSTANDARD1_2 && !NETSTANDARD1_3 && !NETSTANDARD1_4 && !NETSTANDARD1_5 && !NETSTANDARD1_6)
42494249
static class ReverseTypeExtender
42504250
{
42514251
public static bool IsClass(this Type type)

src/Exceptionless/Extensions/ExceptionlessConfigurationExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public static void ReadAllConfig(this ExceptionlessConfiguration config, params
256256
if (configAttributesAssemblies == null || configAttributesAssemblies.Length == 0) {
257257
#if NETSTANDARD1_5
258258
config.ReadFromAttributes(Assembly.GetEntryAssembly());
259-
#elif NET45
259+
#elif NET45 || NETSTANDARD2_0
260260
config.ReadFromAttributes(Assembly.GetEntryAssembly(), Assembly.GetCallingAssembly());
261261
#endif
262262
} else {

src/Exceptionless/Extensions/ReflectionExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static AssemblyName GetAssemblyName(this Assembly assembly) {
1414
}
1515

1616
public static DateTime? GetCreationTime(this Assembly assembly) {
17-
#if NET45 || NETSTANDARD1_5
17+
#if NET45 || NETSTANDARD1_5 || NETSTANDARD2_0
1818
try {
1919
return File.GetCreationTime(assembly.Location);
2020
} catch {}
@@ -24,7 +24,7 @@ public static AssemblyName GetAssemblyName(this Assembly assembly) {
2424
}
2525

2626
public static DateTime? GetLastWriteTime(this Assembly assembly) {
27-
#if NET45 || NETSTANDARD1_5
27+
#if NET45 || NETSTANDARD1_5 || NETSTANDARD2_0
2828
try {
2929
return File.GetLastWriteTime(assembly.Location);
3030
} catch {}

src/Exceptionless/Extensions/ToErrorModelExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ private static void PopulateMethod(this Method method, Error root, MethodBase me
226226
method.Name = methodBase.Name;
227227
if (methodBase.DeclaringType != null) {
228228
method.DeclaringNamespace = methodBase.DeclaringType.Namespace;
229-
#if NET45 || NETSTANDARD1_5
229+
#if NET45 || NETSTANDARD1_5 || NETSTANDARD2_0
230230
if (methodBase.DeclaringType.GetTypeInfo().MemberType == MemberTypes.NestedType && methodBase.DeclaringType.DeclaringType != null)
231231
method.DeclaringType = methodBase.DeclaringType.DeclaringType.Name + "+" + methodBase.DeclaringType.Name;
232232
else
@@ -306,7 +306,7 @@ public static Module ToModuleInfo(this Assembly assembly) {
306306
if (lastWriteTime.HasValue)
307307
mod.ModifiedDate = lastWriteTime.Value;
308308

309-
#if NET45 || NETSTANDARD1_5
309+
#if NET45 || NETSTANDARD1_5 || NETSTANDARD2_0
310310
if (assembly == Assembly.GetEntryAssembly())
311311
mod.IsEntry = true;
312312
#endif

src/Exceptionless/Plugins/Default/080_VersionPlugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void Run(EventPluginContext context) {
3737
}
3838

3939
private string GetVersionFromRuntimeInfo(IExceptionlessLog log) {
40-
#if NETSTANDARD1_3 || NETSTANDARD1_4 || NETSTANDARD1_5
40+
#if NETSTANDARD1_3 || NETSTANDARD1_4 || NETSTANDARD1_5 || NETSTANDARD2_0
4141
try {
4242
var platformService = Microsoft.Extensions.PlatformAbstractions.PlatformServices.Default;
4343
return platformService.Application.ApplicationVersion;

src/Exceptionless/Services/DefaultEnvironmentInfoCollector.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private void PopulateProcessInfo(EnvironmentInfo info) {
7777
try {
7878
#if NETSTANDARD1_5
7979
info.CommandLine = String.Join(" ", Environment.GetCommandLineArgs());
80-
#elif NET45
80+
#elif NET45 || NETSTANDARD2_0
8181
info.CommandLine = Environment.CommandLine;
8282
#endif
8383
} catch (Exception ex) {
@@ -155,7 +155,7 @@ private void PopulateRuntimeInfo(EnvironmentInfo info) {
155155
#endif
156156

157157
try {
158-
#if NET45 || NETSTANDARD1_5
158+
#if NET45 || NETSTANDARD1_5 || NETSTANDARD2_0
159159
info.MachineName = Environment.MachineName;
160160
#elif !PORTABLE && !NETSTANDARD1_2
161161
Process process = Process.GetCurrentProcess();

src/Exceptionless/Utility/AssemblyHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class AssemblyHelper {
1010
public static Assembly GetRootAssembly() {
1111
#if NETSTANDARD1_5
1212
return Assembly.GetEntryAssembly();
13-
#elif NET45
13+
#elif NET45 || NETSTANDARD2_0
1414
return Assembly.GetEntryAssembly() ?? Assembly.GetCallingAssembly();
1515
#else
1616
return null;

0 commit comments

Comments
 (0)