diff --git a/Directory.Build.props b/Directory.Build.props
index d8fddb6cc1..515fcaa446 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -156,13 +156,13 @@
-
-
-
-
diff --git a/src/Prism.Core/Common/IParameters.cs b/src/Prism.Core/Common/IParameters.cs
index 4f1d544d9e..32e1752fdf 100644
--- a/src/Prism.Core/Common/IParameters.cs
+++ b/src/Prism.Core/Common/IParameters.cs
@@ -6,14 +6,14 @@ namespace Prism.Common
///
/// Defines a contract for specifying values associated with a unique key.
///
- public interface IParameters : IEnumerable>
+ public interface IParameters : IEnumerable>
{
///
/// Adds the specified key and value to the parameter collection.
///
/// The key of the parameter to add.
/// The value of the parameter to add.
- void Add(string key, object value);
+ void Add(string key, object? value);
///
/// Determines whether the contains the specified .
diff --git a/src/Prism.Core/Common/ParametersBase.cs b/src/Prism.Core/Common/ParametersBase.cs
index 3814e290ce..9607438191 100644
--- a/src/Prism.Core/Common/ParametersBase.cs
+++ b/src/Prism.Core/Common/ParametersBase.cs
@@ -104,7 +104,7 @@ public object? this[string key]
///
/// The key to reference this value in the parameters collection.
/// The value of the parameter to store.
- public void Add(string key, object value) =>
+ public void Add(string key, object? value) =>
_entries.Add(new KeyValuePair(key, value));
///
@@ -129,7 +129,7 @@ public bool ContainsKey(string key) =>
/// The key for the value to be returned.
/// Returns a matching parameter of if one exists in the Collection.
public T GetValue(string key) =>
- _entries.GetValue(key);
+ _entries.GetValue(key)!;
///
/// Returns an IEnumerable of all parameters.
diff --git a/src/Prism.Core/Common/ParametersExtensions.cs b/src/Prism.Core/Common/ParametersExtensions.cs
index c34b45895d..db4a77ea52 100644
--- a/src/Prism.Core/Common/ParametersExtensions.cs
+++ b/src/Prism.Core/Common/ParametersExtensions.cs
@@ -21,8 +21,13 @@ public static class ParametersExtensions
/// The key of the parameter to find
/// A matching value of if it exists
[EditorBrowsable(EditorBrowsableState.Never)]
- public static T GetValue(this IEnumerable> parameters, string key) =>
- (T)GetValue(parameters, key, typeof(T));
+ public static T GetValue(this IEnumerable> parameters, string key)
+ {
+ object? value = GetValue(parameters, key, typeof(T));
+ if (value is null)
+ return default!;
+ return (T)value;
+ }
///
/// Searches for value referenced by
@@ -33,7 +38,7 @@ public static T GetValue(this IEnumerable> param
/// A matching value of if it exists
/// Unable to convert the value of Type
[EditorBrowsable(EditorBrowsableState.Never)]
- public static object GetValue(this IEnumerable> parameters, string key, Type type)
+ public static object? GetValue(this IEnumerable> parameters, string key, Type type)
{
foreach (var kvp in parameters)
{
@@ -42,7 +47,7 @@ public static object GetValue(this IEnumerable> par
if (TryGetValueInternal(kvp, type, out var value))
return value;
- throw new InvalidCastException($"Unable to convert the value of Type '{kvp.Value.GetType().FullName}' to '{type.FullName}' for the key '{key}' ");
+ throw new InvalidCastException($"Unable to convert the value of Type '{kvp.Value!.GetType().FullName}' to '{type.FullName}' for the key '{key}' ");
}
}
@@ -58,7 +63,7 @@ public static object GetValue(this IEnumerable> par
/// The value of parameter to return
/// Success if value is found; otherwise returns false
[EditorBrowsable(EditorBrowsableState.Never)]
- public static bool TryGetValue(this IEnumerable> parameters, string key, out T value)
+ public static bool TryGetValue(this IEnumerable> parameters, string key, [MaybeNullWhen(false)] out T value)
{
var type = typeof(T);
@@ -75,7 +80,7 @@ public static bool TryGetValue(this IEnumerable>
}
}
- value = default;
+ value = default!;
return false;
}
@@ -87,7 +92,7 @@ public static bool TryGetValue(this IEnumerable>
/// The key of the parameter to find
/// An IEnumerable{T} of all the values referenced by key
[EditorBrowsable(EditorBrowsableState.Never)]
- public static IEnumerable GetValues(this IEnumerable> parameters, string key)
+ public static IEnumerable GetValues(this IEnumerable> parameters, string key)
{
List values = [];
var type = typeof(T);
@@ -105,7 +110,7 @@ public static IEnumerable GetValues(this IEnumerable kvp, Type type, out object value)
+ private static bool TryGetValueInternal(KeyValuePair kvp, Type type, out object? value)
{
value = GetDefault(type);
var valueAsString = kvp.Value is string str ? str : kvp.Value?.ToString();
@@ -141,7 +146,7 @@ private static bool TryGetValueInternal(KeyValuePair kvp, Type t
if (!success && type.GetInterface("System.IConvertible") != null)
{
success = true;
- value = Convert.ChangeType(kvp.Value, type);
+ value = Convert.ChangeType(kvp.Value, type)!;
}
return success;
@@ -154,7 +159,7 @@ private static bool TryGetValueInternal(KeyValuePair kvp, Type t
/// The key to search the for existence
/// true if key exists; false otherwise
[EditorBrowsable(EditorBrowsableState.Never)]
- public static bool ContainsKey(this IEnumerable> parameters, string key) =>
+ public static bool ContainsKey(this IEnumerable> parameters, string key) =>
parameters.Any(x => string.Compare(x.Key, key, StringComparison.Ordinal) == 0);
private static object? GetDefault(Type type) => type.IsValueType ? Activator.CreateInstance(type) : null;
diff --git a/src/Prism.Core/Common/UriParsingHelper.cs b/src/Prism.Core/Common/UriParsingHelper.cs
index e13dbcf7a6..6b646288bf 100644
--- a/src/Prism.Core/Common/UriParsingHelper.cs
+++ b/src/Prism.Core/Common/UriParsingHelper.cs
@@ -74,7 +74,7 @@ public static INavigationParameters GetSegmentParameters(string uriSegment, INav
if (parameters is not null)
{
- foreach (KeyValuePair navigationParameter in parameters)
+ foreach (KeyValuePair navigationParameter in parameters)
{
navParameters.Add(navigationParameter.Key, navigationParameter.Value);
}
@@ -116,7 +116,7 @@ public static IDialogParameters GetSegmentParameters(string uriSegment, IDialogP
if (parameters != null)
{
- foreach (KeyValuePair navigationParameter in parameters)
+ foreach (KeyValuePair navigationParameter in parameters)
{
dialogParameters.Add(navigationParameter.Key, navigationParameter.Value);
}
diff --git a/src/Prism.Core/Modularity/CyclicDependencyFoundException.Desktop.cs b/src/Prism.Core/Modularity/CyclicDependencyFoundException.Desktop.cs
index 103a8f2c04..673cb1f216 100644
--- a/src/Prism.Core/Modularity/CyclicDependencyFoundException.Desktop.cs
+++ b/src/Prism.Core/Modularity/CyclicDependencyFoundException.Desktop.cs
@@ -1,4 +1,4 @@
-
+#if NETFRAMEWORK
using System;
using System.Runtime.Serialization;
@@ -17,3 +17,5 @@ public partial class CyclicDependencyFoundException
protected CyclicDependencyFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}
+
+#endif
diff --git a/src/Prism.Core/Modularity/DuplicateModuleException.Desktop.cs b/src/Prism.Core/Modularity/DuplicateModuleException.Desktop.cs
index 112d3e5aa8..bf670401b2 100644
--- a/src/Prism.Core/Modularity/DuplicateModuleException.Desktop.cs
+++ b/src/Prism.Core/Modularity/DuplicateModuleException.Desktop.cs
@@ -1,4 +1,4 @@
-
+#if NETFRAMEWORK
using System;
using System.Runtime.Serialization;
@@ -17,3 +17,5 @@ public partial class DuplicateModuleException
protected DuplicateModuleException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}
+
+#endif
diff --git a/src/Prism.Core/Modularity/ModularityException.Desktop.cs b/src/Prism.Core/Modularity/ModularityException.Desktop.cs
index 9020ae3592..1e6d25ce7d 100644
--- a/src/Prism.Core/Modularity/ModularityException.Desktop.cs
+++ b/src/Prism.Core/Modularity/ModularityException.Desktop.cs
@@ -1,4 +1,4 @@
-
+#if NETFRAMEWORK
using System;
using System.Runtime.Serialization;
@@ -25,9 +25,7 @@ protected ModularityException(SerializationInfo info, StreamingContext context)
///
/// The that holds the serialized object data about the exception being thrown.
/// The that contains contextual information about the source or destination.
-#if !NET6_0_OR_GREATER
[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.SerializationFormatter)]
-#endif
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
@@ -35,3 +33,5 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont
}
}
}
+
+#endif
diff --git a/src/Prism.Core/Modularity/ModuleInitializeException.Desktop.cs b/src/Prism.Core/Modularity/ModuleInitializeException.Desktop.cs
index b8f562d980..f23436e6f5 100644
--- a/src/Prism.Core/Modularity/ModuleInitializeException.Desktop.cs
+++ b/src/Prism.Core/Modularity/ModuleInitializeException.Desktop.cs
@@ -1,4 +1,4 @@
-
+#if NETFRAMEWORK
using System;
using System.Runtime.Serialization;
@@ -19,3 +19,5 @@ protected ModuleInitializeException(SerializationInfo info, StreamingContext con
}
}
}
+
+#endif
diff --git a/src/Prism.Core/Modularity/ModuleNotFoundException.Desktop.cs b/src/Prism.Core/Modularity/ModuleNotFoundException.Desktop.cs
index e4ab20ff07..6af22c89c3 100644
--- a/src/Prism.Core/Modularity/ModuleNotFoundException.Desktop.cs
+++ b/src/Prism.Core/Modularity/ModuleNotFoundException.Desktop.cs
@@ -1,4 +1,4 @@
-
+#if NETFRAMEWORK
using System;
using System.Runtime.Serialization;
@@ -22,3 +22,5 @@ protected ModuleNotFoundException(SerializationInfo info, StreamingContext conte
}
}
}
+
+#endif
diff --git a/src/Prism.Core/Modularity/ModuleTypeLoadingException.Desktop.cs b/src/Prism.Core/Modularity/ModuleTypeLoadingException.Desktop.cs
index 9c0c86260a..8e7648edb9 100644
--- a/src/Prism.Core/Modularity/ModuleTypeLoadingException.Desktop.cs
+++ b/src/Prism.Core/Modularity/ModuleTypeLoadingException.Desktop.cs
@@ -1,4 +1,4 @@
-
+#if NETFRAMEWORK
using System;
using System.Runtime.Serialization;
@@ -19,3 +19,5 @@ protected ModuleTypeLoadingException(SerializationInfo info, StreamingContext co
}
}
}
+
+#endif
diff --git a/src/Prism.Core/Mvvm/ErrorsContainer.cs b/src/Prism.Core/Mvvm/ErrorsContainer.cs
index ad5bbeb864..8d95a7e882 100644
--- a/src/Prism.Core/Mvvm/ErrorsContainer.cs
+++ b/src/Prism.Core/Mvvm/ErrorsContainer.cs
@@ -9,7 +9,7 @@ namespace Prism.Mvvm
/// The type of the error object.
public class ErrorsContainer
{
- private static readonly T[] noErrors = new T[0];
+ private static readonly T[] noErrors = [];
///
/// Delegate to be called when raiseErrorsChanged is invoked.
@@ -27,25 +27,23 @@ public class ErrorsContainer
/// The action that is invoked when errors are added for an object.
public ErrorsContainer(Action raiseErrorsChanged)
{
+#if NETFRAMEWORK
if (raiseErrorsChanged == null)
{
throw new ArgumentNullException(nameof(raiseErrorsChanged));
}
+#else
+ ArgumentNullException.ThrowIfNull(raiseErrorsChanged);
+#endif
this.raiseErrorsChanged = raiseErrorsChanged;
- this.validationResults = new Dictionary>();
+ validationResults = [];
}
///
/// Gets a value indicating whether the object has validation errors.
///
- public bool HasErrors
- {
- get
- {
- return this.validationResults.Count != 0;
- }
- }
+ public bool HasErrors => validationResults.Count != 0;
///
/// Returns all the errors in the container.
@@ -61,7 +59,7 @@ public bool HasErrors
public IEnumerable GetErrors(string? propertyName)
{
var localPropertyName = propertyName ?? string.Empty;
- if (this.validationResults.TryGetValue(localPropertyName, out var currentValidationResults))
+ if (validationResults.TryGetValue(localPropertyName, out var currentValidationResults))
{
return currentValidationResults;
}
@@ -76,7 +74,7 @@ public IEnumerable GetErrors(string? propertyName)
///
public void ClearErrors()
{
- foreach (var key in this.validationResults.Keys.ToArray())
+ foreach (var key in validationResults.Keys.ToArray())
{
ClearErrors(key);
}
@@ -94,7 +92,7 @@ public void ClearErrors()
public void ClearErrors(Expression> propertyExpression)
{
var propertyName = PropertySupport.ExtractPropertyName(propertyExpression);
- this.ClearErrors(propertyName);
+ ClearErrors(propertyName);
}
///
@@ -104,7 +102,7 @@ public void ClearErrors(Expression> propertyExpressio
///
/// container.ClearErrors("SomeProperty");
///
- public void ClearErrors(string? propertyName) => this.SetErrors(propertyName, new List());
+ public void ClearErrors(string? propertyName) => SetErrors(propertyName, new List());
///
/// Sets the validation errors for the specified property.
@@ -116,7 +114,7 @@ public void ClearErrors(Expression> propertyExpressio
public void SetErrors(Expression> propertyExpression, IEnumerable? propertyErrors)
{
var propertyName = PropertySupport.ExtractPropertyName(propertyExpression);
- this.SetErrors(propertyName, propertyErrors);
+ SetErrors(propertyName, propertyErrors);
}
///
@@ -130,20 +128,20 @@ public void SetErrors(Expression> propertyExpression,
public void SetErrors(string? propertyName, IEnumerable? newValidationResults)
{
var localPropertyName = propertyName ?? string.Empty;
- var hasCurrentValidationResults = this.validationResults.ContainsKey(localPropertyName);
+ var hasCurrentValidationResults = validationResults.ContainsKey(localPropertyName);
var hasNewValidationResults = newValidationResults != null && newValidationResults.Count() > 0;
if (hasCurrentValidationResults || hasNewValidationResults)
{
if (hasNewValidationResults)
{
- this.validationResults[localPropertyName] = new List(newValidationResults);
- this.raiseErrorsChanged(localPropertyName);
+ validationResults[localPropertyName] = new List(newValidationResults!);
+ raiseErrorsChanged(localPropertyName);
}
else
{
- this.validationResults.Remove(localPropertyName);
- this.raiseErrorsChanged(localPropertyName);
+ validationResults.Remove(localPropertyName);
+ raiseErrorsChanged(localPropertyName);
}
}
}
diff --git a/src/Prism.Core/Mvvm/PropertySupport.cs b/src/Prism.Core/Mvvm/PropertySupport.cs
index 26197d80c2..167e068867 100644
--- a/src/Prism.Core/Mvvm/PropertySupport.cs
+++ b/src/Prism.Core/Mvvm/PropertySupport.cs
@@ -54,7 +54,7 @@ public static class PropertySupport
throw new ArgumentException(Resources.PropertySupport_ExpressionNotProperty_Exception, nameof(expression));
var getMethod = property.GetMethod;
- if (getMethod.IsStatic)
+ if (getMethod is null || getMethod.IsStatic)
throw new ArgumentException(Resources.PropertySupport_StaticExpression_Exception, nameof(expression));
return memberExpression.Member.Name;
diff --git a/src/Prism.Core/Mvvm/ViewModelLocationProvider.cs b/src/Prism.Core/Mvvm/ViewModelLocationProvider.cs
index 22c112a5f5..bf66b061d2 100644
--- a/src/Prism.Core/Mvvm/ViewModelLocationProvider.cs
+++ b/src/Prism.Core/Mvvm/ViewModelLocationProvider.cs
@@ -26,7 +26,7 @@ public static void Reset()
{
_factories = new Dictionary>();
_typeFactories = new Dictionary();
- _defaultViewModelFactory = type => Activator.CreateInstance(type);
+ _defaultViewModelFactory = type => Activator.CreateInstance(type)!;
_defaultViewModelFactoryWithViewParameter = null;
_defaultViewTypeToViewModelTypeResolver = DefaultViewTypeToViewModel;
}
@@ -44,7 +44,7 @@ public static void Reset()
///
/// The default view model factory which provides the ViewModel type as a parameter.
///
- static Func _defaultViewModelFactory = type => Activator.CreateInstance(type);
+ static Func _defaultViewModelFactory = type => Activator.CreateInstance(type)!;
///
/// ViewModelFactory that provides the View instance and ViewModel type as parameters.
diff --git a/src/Prism.Core/Mvvm/ViewRegistryBase{TBaseView}.cs b/src/Prism.Core/Mvvm/ViewRegistryBase{TBaseView}.cs
index 744845087c..ad2b04f0ca 100644
--- a/src/Prism.Core/Mvvm/ViewRegistryBase{TBaseView}.cs
+++ b/src/Prism.Core/Mvvm/ViewRegistryBase{TBaseView}.cs
@@ -129,7 +129,8 @@ private IEnumerable GetCandidates(Type viewModelType)
return candidates
.Select(x => Type.GetType(x, false))
- .Where(x => x is not null);
+ .Where(x => x is not null)
+ .Cast();
}
return [];
diff --git a/src/Prism.Core/Navigation/INavigationParametersInternal.cs b/src/Prism.Core/Navigation/INavigationParametersInternal.cs
index 8e669fdc73..23151e5c25 100644
--- a/src/Prism.Core/Navigation/INavigationParametersInternal.cs
+++ b/src/Prism.Core/Navigation/INavigationParametersInternal.cs
@@ -1,4 +1,6 @@
-namespace Prism.Navigation;
+#nullable enable
+
+namespace Prism.Navigation;
///
/// Used to set internal parameters used by Prism
@@ -10,7 +12,7 @@ public interface INavigationParametersInternal
///
/// The key to reference this value in the parameters collection.
/// The value of the parameter to store
- void Add(string key, object value);
+ void Add(string key, object? value);
///
/// Checks collection for presence of key
diff --git a/src/Prism.Core/Navigation/NavigationParameters.cs b/src/Prism.Core/Navigation/NavigationParameters.cs
index 7fbf5cc63a..0b5d3845c5 100644
--- a/src/Prism.Core/Navigation/NavigationParameters.cs
+++ b/src/Prism.Core/Navigation/NavigationParameters.cs
@@ -1,6 +1,8 @@
using System.Collections.Generic;
using Prism.Common;
+#nullable enable
+
namespace Prism.Navigation;
///
@@ -11,7 +13,7 @@ namespace Prism.Navigation;
///
public class NavigationParameters : ParametersBase, INavigationParameters, INavigationParametersInternal
{
- private readonly Dictionary _internalParameters = new Dictionary();
+ private readonly Dictionary _internalParameters = new Dictionary();
///
/// Initializes a new instance of the class.
@@ -30,7 +32,7 @@ public NavigationParameters(string query)
}
#region INavigationParametersInternal
- void INavigationParametersInternal.Add(string key, object value)
+ void INavigationParametersInternal.Add(string key, object? value)
{
_internalParameters.Add(key, value);
}
@@ -42,7 +44,7 @@ bool INavigationParametersInternal.ContainsKey(string key)
T INavigationParametersInternal.GetValue(string key)
{
- return _internalParameters.GetValue(key);
+ return _internalParameters.GetValue(key)!;
}
#endregion
}
diff --git a/src/Prism.Core/Navigation/Regions/NavigationContext.cs b/src/Prism.Core/Navigation/Regions/NavigationContext.cs
index b39d15a016..5277a4e20f 100644
--- a/src/Prism.Core/Navigation/Regions/NavigationContext.cs
+++ b/src/Prism.Core/Navigation/Regions/NavigationContext.cs
@@ -63,7 +63,7 @@ private void GetNavigationParameters(INavigationParameters navigationParameters)
if (navigationParameters != null)
{
- foreach (KeyValuePair navigationParameter in navigationParameters)
+ foreach (var navigationParameter in navigationParameters)
{
Parameters.Add(navigationParameter.Key, navigationParameter.Value);
}
diff --git a/src/Prism.Core/Navigation/Regions/RegionCreationException.cs b/src/Prism.Core/Navigation/Regions/RegionCreationException.cs
index 6fd9cff532..186ba13c82 100644
--- a/src/Prism.Core/Navigation/Regions/RegionCreationException.cs
+++ b/src/Prism.Core/Navigation/Regions/RegionCreationException.cs
@@ -1,14 +1,16 @@
using System;
-using System.Collections.Generic;
+#if NETFRAMEWORK
using System.Runtime.Serialization;
-using System.Text;
+#endif
namespace Prism.Navigation.Regions;
///
/// An exception used when encountering an error in the creation of a Region
///
+#if NETFRAMEWORK
[Serializable]
+#endif
public sealed class RegionCreationException : RegionException
{
///
@@ -21,10 +23,12 @@ public RegionCreationException(string message) : base(message)
{
}
- ///
+#if NETFRAMEWORK
+ ///
public RegionCreationException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
+#endif
///
public RegionCreationException(string message, Exception innerException) : base(message, innerException)
diff --git a/src/Prism.Core/Navigation/Regions/RegionException.cs b/src/Prism.Core/Navigation/Regions/RegionException.cs
index 85a56cf976..bc6fee3735 100644
--- a/src/Prism.Core/Navigation/Regions/RegionException.cs
+++ b/src/Prism.Core/Navigation/Regions/RegionException.cs
@@ -1,5 +1,7 @@
using System;
+#if NETFRAMEWORK
using System.Runtime.Serialization;
+#endif
namespace Prism.Navigation.Regions;
@@ -18,10 +20,12 @@ protected RegionException(string message) : base(message)
{
}
- ///
+#if NETFRAMEWORK
+ ///
protected RegionException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
+#endif
///
protected RegionException(string message, Exception innerException) : base(message, innerException)
diff --git a/src/Prism.Core/Navigation/Regions/RegionViewException.cs b/src/Prism.Core/Navigation/Regions/RegionViewException.cs
index fa865dd03f..f1ce829717 100644
--- a/src/Prism.Core/Navigation/Regions/RegionViewException.cs
+++ b/src/Prism.Core/Navigation/Regions/RegionViewException.cs
@@ -1,5 +1,7 @@
using System;
+#if NETFRAMEWORK
using System.Runtime.Serialization;
+#endif
namespace Prism.Navigation.Regions;
@@ -23,10 +25,12 @@ public RegionViewException(string message) : base(message)
{
}
- ///
+#if NETFRAMEWORK
+ ///
public RegionViewException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
+#endif
///
/// Initializes a new
diff --git a/src/Prism.Core/Navigation/Regions/UpdateRegionsException.cs b/src/Prism.Core/Navigation/Regions/UpdateRegionsException.cs
index ca2c7dea0a..42ab06b1cd 100644
--- a/src/Prism.Core/Navigation/Regions/UpdateRegionsException.cs
+++ b/src/Prism.Core/Navigation/Regions/UpdateRegionsException.cs
@@ -1,12 +1,16 @@
using System;
+#if NETFRAMEWORK
using System.Runtime.Serialization;
+#endif
namespace Prism.Navigation.Regions
{
///
/// Represents errors that occurred during the regions' update.
///
+#if NETFRAMEWORK
[Serializable]
+#endif
public partial class UpdateRegionsException : Exception
{
///
@@ -37,6 +41,7 @@ public UpdateRegionsException(string message, Exception inner)
{
}
+#if NETFRAMEWORK
///
/// Initializes a new instance of the class with serialized data.
///
@@ -46,5 +51,6 @@ protected UpdateRegionsException(SerializationInfo info, StreamingContext contex
: base(info, context)
{
}
+#endif
}
}
diff --git a/src/Prism.Core/Navigation/Regions/ViewRegistrationException.cs b/src/Prism.Core/Navigation/Regions/ViewRegistrationException.cs
index f2a75eac13..a0c1f56608 100644
--- a/src/Prism.Core/Navigation/Regions/ViewRegistrationException.cs
+++ b/src/Prism.Core/Navigation/Regions/ViewRegistrationException.cs
@@ -1,12 +1,16 @@
using System;
+#if NETFRAMEWORK
using System.Runtime.Serialization;
+#endif
namespace Prism.Navigation.Regions
{
///
/// Exception that's thrown when something goes wrong while Registering a View with a region name in the class.
///
+#if NETFRAMEWORK
[Serializable]
+#endif
public partial class ViewRegistrationException : Exception
{
// TODO: Find updated links as these are dead...
@@ -41,6 +45,7 @@ public ViewRegistrationException(string message, Exception inner) : base(message
{
}
+#if NETFRAMEWORK
///
/// Initializes a new instance of the class with serialized data.
///
@@ -51,5 +56,6 @@ protected ViewRegistrationException(SerializationInfo info, StreamingContext con
: base(info, context)
{
}
+#endif
}
}