diff --git a/Tests/ZeroLevel.UnitTests/Models/TestSerializableDTO.cs b/Tests/ZeroLevel.UnitTests/Models/TestSerializableDTO.cs
index 6c53e6c..0d2d9ca 100644
--- a/Tests/ZeroLevel.UnitTests/Models/TestSerializableDTO.cs
+++ b/Tests/ZeroLevel.UnitTests/Models/TestSerializableDTO.cs
@@ -37,5 +37,10 @@ namespace ZeroLevel.UnitTests.Models
writer.WriteString(this.Title);
writer.WriteLong(this.Timestamp);
}
+
+ public override int GetHashCode()
+ {
+ return Id.GetHashCode() ^ (Title?.GetHashCode() ?? 0) ^ Timestamp.GetHashCode();
+ }
}
}
diff --git a/Tests/ZeroLevel.UnitTests/TokenEncryptorTest.cs b/Tests/ZeroLevel.UnitTests/TokenEncryptorTest.cs
index 15ef310..c4585ab 100644
--- a/Tests/ZeroLevel.UnitTests/TokenEncryptorTest.cs
+++ b/Tests/ZeroLevel.UnitTests/TokenEncryptorTest.cs
@@ -37,6 +37,11 @@ namespace ZeroLevel.UnitTests
writer.WriteString(this.Login);
writer.WriteString(this.Name);
}
+
+ public override int GetHashCode()
+ {
+ return (Login?.GetHashCode() ?? 0) ^ (Name?.GetHashCode() ?? 0);
+ }
}
[Fact]
diff --git a/ZeroLevel.ML/ImageMetainfo.cs b/ZeroLevel.ML/ImageMetainfo.cs
index 260cc83..270706f 100644
--- a/ZeroLevel.ML/ImageMetainfo.cs
+++ b/ZeroLevel.ML/ImageMetainfo.cs
@@ -104,7 +104,7 @@ p2 pixel units = -p2 focal units / focal length
public sealed class ImageMetainfo
{
- private CameraMath _camera = null;
+ private CameraMath _camera = null!;
public CameraMath CreateCamera()
{
if (_camera == null)
diff --git a/ZeroLevel.ML/ZeroLevel.ML.csproj b/ZeroLevel.ML/ZeroLevel.ML.csproj
index ed005df..8999d1e 100644
--- a/ZeroLevel.ML/ZeroLevel.ML.csproj
+++ b/ZeroLevel.ML/ZeroLevel.ML.csproj
@@ -5,6 +5,9 @@
netstandard2.1
enable
True
+ $(AssemblyVersion)
+ 4.0.0.0
+ $(AssemblyVersion)
diff --git a/ZeroLevel.MsSql/ZeroLevel.MsSql.csproj b/ZeroLevel.MsSql/ZeroLevel.MsSql.csproj
index 42b7706..d6714ca 100644
--- a/ZeroLevel.MsSql/ZeroLevel.MsSql.csproj
+++ b/ZeroLevel.MsSql/ZeroLevel.MsSql.csproj
@@ -1,16 +1,20 @@
-
- netstandard2.1
- enable
-
+
+ latest
+ netstandard2.1
+ enable
+ $(AssemblyVersion)
+ 4.0.0.0
+ $(AssemblyVersion)
+
-
-
-
+
+
+
-
-
-
+
+
+
diff --git a/ZeroLevel.Sleopok.Engine/ZeroLevel.Sleopok.Engine.csproj b/ZeroLevel.Sleopok.Engine/ZeroLevel.Sleopok.Engine.csproj
index 20c1104..e8df569 100644
--- a/ZeroLevel.Sleopok.Engine/ZeroLevel.Sleopok.Engine.csproj
+++ b/ZeroLevel.Sleopok.Engine/ZeroLevel.Sleopok.Engine.csproj
@@ -1,12 +1,16 @@
-
- netstandard2.1
- enable
-
+
+ latest
+ netstandard2.1
+ enable
+ $(AssemblyVersion)
+ 4.0.0.0
+ $(AssemblyVersion)
+
-
-
-
+
+
+
diff --git a/ZeroLevel/DataStructures/SparseMatrix.cs b/ZeroLevel/DataStructures/SparseMatrix.cs
index 4dd46fb..ad5aa77 100644
--- a/ZeroLevel/DataStructures/SparseMatrix.cs
+++ b/ZeroLevel/DataStructures/SparseMatrix.cs
@@ -56,7 +56,7 @@ namespace ZeroLevel.DataStructures
}
//If there is no item on the given position return defaault value
- return default(T);
+ return default(T)!;
}
set
{
diff --git a/ZeroLevel/Models/ZeroServiceInfo.cs b/ZeroLevel/Models/ZeroServiceInfo.cs
index f6de918..eaae7f0 100644
--- a/ZeroLevel/Models/ZeroServiceInfo.cs
+++ b/ZeroLevel/Models/ZeroServiceInfo.cs
@@ -42,7 +42,7 @@ namespace ZeroLevel
public bool Equals(ZeroServiceInfo other)
{
- if (other == null) return false;
+ if (other == null!) return false;
if (object.ReferenceEquals(this, other)) return true;
if (string.Compare(this.Name, other.Name, true) != 0) return false;
if (string.Compare(this.ServiceKey, other.ServiceKey, true) != 0) return false;
@@ -54,7 +54,7 @@ namespace ZeroLevel
public override bool Equals(object obj)
{
- return this.Equals(obj as ZeroServiceInfo);
+ return this.Equals((obj as ZeroServiceInfo)!);
}
public override int GetHashCode()
diff --git a/ZeroLevel/Services/BaseZeroService.cs b/ZeroLevel/Services/BaseZeroService.cs
index c46e014..d549b4f 100644
--- a/ZeroLevel/Services/BaseZeroService.cs
+++ b/ZeroLevel/Services/BaseZeroService.cs
@@ -127,7 +127,7 @@ namespace ZeroLevel.Services.Applications
}
}
}
- return default(T);
+ return default(T)!;
}
#endregion Config
diff --git a/ZeroLevel/Services/Bootstrap.cs b/ZeroLevel/Services/Bootstrap.cs
index f10504a..413520c 100644
--- a/ZeroLevel/Services/Bootstrap.cs
+++ b/ZeroLevel/Services/Bootstrap.cs
@@ -29,7 +29,7 @@ namespace ZeroLevel
public BootstrapFluent(IZeroService service)
{
- if (service == null)
+ if (service == null!)
{
throw new ArgumentNullException(nameof(service));
}
@@ -56,7 +56,7 @@ namespace ZeroLevel
catch (Exception ex)
{
Log.Error(ex, $"[Bootstrap] Service {_service?.Name} run error");
- return null;
+ return null!;
}
return this;
}
@@ -108,7 +108,7 @@ namespace ZeroLevel
{
Log.Info($"[Bootstrap] Resolve assembly '{args.Name}' {args.Name}");
string name = args.Name.Split(',')[0];
- if (name.EndsWith(".resources")) return null;
+ if (name.EndsWith(".resources")) return null!;
foreach (string file in Directory.
GetFiles(Path.Combine(Configuration.BaseDirectory), "*.dll", SearchOption.TopDirectoryOnly))
{
@@ -123,7 +123,7 @@ namespace ZeroLevel
{
Log.Error(ex, $"[Bootstrap] Fault load assembly '{args.Name}'");
}
- return null;
+ return null!;
}
public static BootstrapFluent Startup(string[] args,
@@ -155,13 +155,13 @@ namespace ZeroLevel
IZeroService service = null!;
IConfigurationSet config = Configuration.DefaultSet;
config.CreateSection("commandline", Configuration.ReadFromCommandLine(args));
- if (configurationSet != null)
+ if (configurationSet != null!)
{
config.Merge(configurationSet);
}
Log.CreateLoggingFromConfiguration(Configuration.DefaultSet);
- if (preStartConfiguration != null)
+ if (preStartConfiguration != null!)
{
try
{
@@ -185,20 +185,20 @@ namespace ZeroLevel
{
Log.SystemError(ex, "[Bootstrap] Service start canceled, service constructor call fault");
}
- if (postStartConfiguration != null)
+ if (postStartConfiguration != null!)
{
try
{
if (postStartConfiguration() == false)
{
Log.SystemInfo("[Bootstrap] Service start canceled, because custom postconfig return false");
- return null;
+ return null!;
}
}
catch (Exception ex)
{
Log.SystemError(ex, "[Bootstrap] Service start canceled, postconfig faulted");
- return null;
+ return null!;
}
}
return service;
diff --git a/ZeroLevel/Services/Cache/LRUCache.cs b/ZeroLevel/Services/Cache/LRUCache.cs
index 24db5d9..2f5a814 100644
--- a/ZeroLevel/Services/Cache/LRUCache.cs
+++ b/ZeroLevel/Services/Cache/LRUCache.cs
@@ -58,7 +58,7 @@ namespace ZeroLevel.Services.Cache
}
}
- value = default(TValue);
+ value = default(TValue)!;
return false;
}
diff --git a/ZeroLevel/Services/Cache/TimerCachee.cs b/ZeroLevel/Services/Cache/TimerCachee.cs
index 2f3fdfa..b5c5543 100644
--- a/ZeroLevel/Services/Cache/TimerCachee.cs
+++ b/ZeroLevel/Services/Cache/TimerCachee.cs
@@ -62,7 +62,7 @@ namespace ZeroLevel.Services.Cache
{
try
{
- if (_onDisposeAction != null)
+ if (_onDisposeAction != null!)
{
_onDisposeAction.Invoke(v.Value);
}
@@ -92,7 +92,7 @@ namespace ZeroLevel.Services.Cache
{
try
{
- if (_onDisposeAction != null)
+ if (_onDisposeAction != null!)
{
_onDisposeAction.Invoke(_cachee[key].Value);
}
@@ -114,7 +114,7 @@ namespace ZeroLevel.Services.Cache
{
try
{
- if (_onDisposeAction != null)
+ if (_onDisposeAction != null!)
{
_onDisposeAction.Invoke(pair.Value.Value);
}
diff --git a/ZeroLevel/Services/Collections/Capacitor.cs b/ZeroLevel/Services/Collections/Capacitor.cs
index 4c11fb5..ec625c8 100644
--- a/ZeroLevel/Services/Collections/Capacitor.cs
+++ b/ZeroLevel/Services/Collections/Capacitor.cs
@@ -18,7 +18,7 @@ namespace ZeroLevel.Services.Collections
public Capacitor(int dischargeValue, Action dischargeAction)
{
if (dischargeValue < 1) dischargeValue = 16;
- if (dischargeAction == null) throw new ArgumentNullException(nameof(dischargeAction));
+ if (dischargeAction == null!) throw new ArgumentNullException(nameof(dischargeAction));
_buffer = new T[dischargeValue];
_dischargeAction = dischargeAction;
}
diff --git a/ZeroLevel/Services/Collections/ConcurrentHashSet.cs b/ZeroLevel/Services/Collections/ConcurrentHashSet.cs
index e8635cd..418f059 100644
--- a/ZeroLevel/Services/Collections/ConcurrentHashSet.cs
+++ b/ZeroLevel/Services/Collections/ConcurrentHashSet.cs
@@ -187,7 +187,7 @@ namespace ZeroLevel.Collections
public ConcurrentHashSet(IEnumerable collection, IEqualityComparer comparer)
: this(comparer)
{
- if (collection == null) throw new ArgumentNullException(nameof(collection));
+ if (collection == null!) throw new ArgumentNullException(nameof(collection));
InitializeFromCollection(collection);
}
@@ -214,7 +214,7 @@ namespace ZeroLevel.Collections
public ConcurrentHashSet(int concurrencyLevel, IEnumerable collection, IEqualityComparer comparer)
: this(concurrencyLevel, DefaultCapacity, false, comparer)
{
- if (collection == null) throw new ArgumentNullException(nameof(collection));
+ if (collection == null!) throw new ArgumentNullException(nameof(collection));
InitializeFromCollection(collection);
}
@@ -337,7 +337,7 @@ namespace ZeroLevel.Collections
// The Volatile.Read ensures that the load of the fields of 'n' doesn't move before the load from buckets[i].
var current = Volatile.Read(ref tables.Buckets[bucketNo]);
- while (current != null)
+ while (current != null!)
{
if (hashcode == current.Hashcode && _comparer.Equals(current.Item, equalValue))
{
@@ -348,7 +348,7 @@ namespace ZeroLevel.Collections
current = current.Next;
}
- actualValue = default;
+ actualValue = default!;
return false;
}
@@ -376,13 +376,13 @@ namespace ZeroLevel.Collections
}
Node previous = null!;
- for (var current = tables.Buckets[bucketNo]; current != null; current = current.Next)
+ for (var current = tables.Buckets[bucketNo]; current != null!; current = current.Next)
{
Debug.Assert((previous == null && current == tables.Buckets[bucketNo]) || previous!.Next == current);
if (hashcode == current.Hashcode && _comparer.Equals(current.Item, item))
{
- if (previous == null)
+ if (previous == null!)
{
Volatile.Write(ref tables.Buckets[bucketNo], current.Next);
}
@@ -434,7 +434,7 @@ namespace ZeroLevel.Collections
// Provides a manually-implemented version of (approximately) this iterator:
// Node?[] buckets = _tables.Buckets;
// for (int i = 0; i < buckets.Length; i++)
- // for (Node? current = Volatile.Read(ref buckets[i]); current != null; current = current.Next)
+ // for (Node? current = Volatile.Read(ref buckets[i]); current != null!; current = current.Next)
// yield return new current.Item;
private readonly ConcurrentHashSet _set;
@@ -502,7 +502,7 @@ namespace ZeroLevel.Collections
case StateOuterloop:
Node[] buckets = _buckets;
- Debug.Assert(buckets != null);
+ Debug.Assert(buckets != null!);
int i = ++_i;
if ((uint)i < (uint)buckets!.Length)
@@ -517,7 +517,7 @@ namespace ZeroLevel.Collections
case StateInnerLoop:
Node node = _node;
- if (node != null)
+ if (node != null!)
{
Current = node.Item;
_node = node.Next;
@@ -538,7 +538,7 @@ namespace ZeroLevel.Collections
void ICollection.CopyTo(T[] array, int arrayIndex)
{
- if (array == null) throw new ArgumentNullException(nameof(array));
+ if (array == null!) throw new ArgumentNullException(nameof(array));
if (arrayIndex < 0) throw new ArgumentOutOfRangeException(nameof(arrayIndex));
var locksAcquired = 0;
@@ -606,8 +606,8 @@ namespace ZeroLevel.Collections
}
// Try to find this item in the bucket
- Node previous = null;
- for (var current = tables.Buckets[bucketNo]; current != null; current = current.Next)
+ Node previous = null!;
+ for (var current = tables.Buckets[bucketNo]; current != null!; current = current.Next)
{
Debug.Assert(previous == null && current == tables.Buckets[bucketNo] || previous!.Next == current);
if (hashcode == current.Hashcode && _comparer.Equals(current.Item, item))
@@ -791,7 +791,7 @@ namespace ZeroLevel.Collections
for (var i = 0; i < tables.Buckets.Length; i++)
{
var current = tables.Buckets[i];
- while (current != null)
+ while (current != null!)
{
var next = current.Next;
GetBucketAndLockNo(current.Hashcode, out int newBucketNo, out int newLockNo, newBuckets.Length, newLocks.Length);
@@ -868,7 +868,7 @@ namespace ZeroLevel.Collections
var buckets = _tables.Buckets;
for (var i = 0; i < buckets.Length; i++)
{
- for (var current = buckets[i]; current != null; current = current.Next)
+ for (var current = buckets[i]; current != null!; current = current.Next)
{
array[index] = current.Item;
index++; //this should never flow, CopyToItems is only called when there's no overflow risk
diff --git a/ZeroLevel/Services/Collections/EverythingStorage.cs b/ZeroLevel/Services/Collections/EverythingStorage.cs
index a2c88bb..07805f5 100644
--- a/ZeroLevel/Services/Collections/EverythingStorage.cs
+++ b/ZeroLevel/Services/Collections/EverythingStorage.cs
@@ -59,14 +59,14 @@ namespace ZeroLevel.Services.Collections
public void Insert(string key, T entity)
{
- _insert.Invoke(_instance, new object[] { key, entity });
+ _insert.Invoke(_instance, new object[] { key, entity! });
}
public void InsertOrUpdate(string key, T entity)
{
if ((bool)_containsKey.Invoke(_instance, key))
_remove.Invoke(_instance, key);
- _insert.Invoke(_instance, new object[] { key, entity });
+ _insert.Invoke(_instance, new object[] { key, entity! });
}
public bool ContainsKey(string key)
diff --git a/ZeroLevel/Services/Collections/FastBitArray.cs b/ZeroLevel/Services/Collections/FastBitArray.cs
index 30fdc95..efbf569 100644
--- a/ZeroLevel/Services/Collections/FastBitArray.cs
+++ b/ZeroLevel/Services/Collections/FastBitArray.cs
@@ -62,7 +62,7 @@ namespace ZeroLevel.Collections
=========================================================================*/
public FastBitArray(byte[] bytes)
{
- if (bytes == null)
+ if (bytes == null!)
{
throw new ArgumentNullException(nameof(bytes));
}
@@ -135,7 +135,7 @@ namespace ZeroLevel.Collections
private void SetValues(int[] values)
{
- if (values == null)
+ if (values == null!)
{
throw new ArgumentNullException(nameof(values));
}
@@ -157,7 +157,7 @@ namespace ZeroLevel.Collections
=========================================================================*/
public FastBitArray(FastBitArray bits)
{
- if (bits == null)
+ if (bits == null!)
{
throw new ArgumentNullException(nameof(bits));
}
@@ -183,7 +183,7 @@ namespace ZeroLevel.Collections
private void SetValues(bool[] values)
{
- if (values == null)
+ if (values == null!)
{
throw new ArgumentNullException(nameof(values));
}
@@ -276,7 +276,7 @@ namespace ZeroLevel.Collections
=========================================================================*/
public FastBitArray And(FastBitArray value)
{
- if (value == null)
+ if (value == null!)
throw new ArgumentNullException(nameof(value));
if (Length != value.Length)
throw new ArgumentException("The array lengths differ.");
@@ -303,7 +303,7 @@ namespace ZeroLevel.Collections
=========================================================================*/
public FastBitArray Or(FastBitArray value)
{
- if (value == null)
+ if (value == null!)
throw new ArgumentNullException(nameof(value));
if (Length != value.Length)
throw new ArgumentException("The array lengths differ");
@@ -385,7 +385,7 @@ namespace ZeroLevel.Collections
=========================================================================*/
public FastBitArray Xor(FastBitArray value)
{
- if (value == null)
+ if (value == null!)
throw new ArgumentNullException(nameof(value));
if (Length != value.Length)
throw new ArgumentException("The array lengths differ");
@@ -465,7 +465,7 @@ namespace ZeroLevel.Collections
// ICollection implementation
public void CopyTo(Array array, int index)
{
- if (array == null)
+ if (array == null!)
throw new ArgumentNullException(nameof(array));
if (index < 0)
throw new ArgumentOutOfRangeException(nameof(index), "The index cannot be less than 0.");
@@ -508,7 +508,7 @@ namespace ZeroLevel.Collections
public Object Clone()
{
- Contract.Ensures(Contract.Result