diff --git a/.editorconfig b/.editorconfig
index 06e698247..0e4883082 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -368,8 +368,6 @@ csharp_style_throw_expression = true:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
-csharp_style_var_for_built_in_types = false:silent
+csharp_style_var_for_built_in_types = never
csharp_style_var_when_type_is_apparent = true:warning
csharp_style_var_elsewhere = false:warning
-
-csharp_prefer_simple_using_statement = false:silent
diff --git a/.gitmodules b/.gitmodules
index e7972649f..55389121f 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -2,3 +2,6 @@
path = tests/Images/External
url = https://github.com/SixLabors/Imagesharp.Tests.Images.git
branch = master
+[submodule "shared-infrastructure"]
+ path = shared-infrastructure
+ url = https://github.com/SixLabors/SharedInfrastructure
diff --git a/ImageSharp.sln b/ImageSharp.sln
index 40878c575..f1d4afef4 100644
--- a/ImageSharp.sln
+++ b/ImageSharp.sln
@@ -334,6 +334,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageSharp.Tests.ProfilingS
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
+ shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems*{2aa31a1f-142c-43f4-8687-09abca4b3a26}*SharedItemsImports = 5
shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems*{68a8cc40-6aed-4e96-b524-31b1158fdeea}*SharedItemsImports = 13
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/shared-infrastructure b/shared-infrastructure
new file mode 160000
index 000000000..8dfef29f1
--- /dev/null
+++ b/shared-infrastructure
@@ -0,0 +1 @@
+Subproject commit 8dfef29f1838da76be9596f1a2f1be6d93e453d3
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 2c13e469f..a78a75d42 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -34,4 +34,6 @@
+
+
diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets
index 68d4f8949..e2c289c10 100644
--- a/src/Directory.Build.targets
+++ b/src/Directory.Build.targets
@@ -52,4 +52,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
diff --git a/src/ImageSharp/Common/Helpers/Guard.cs b/src/ImageSharp/Common/Helpers/Guard.cs
index 1d215d286..3ab1b199a 100644
--- a/src/ImageSharp/Common/Helpers/Guard.cs
+++ b/src/ImageSharp/Common/Helpers/Guard.cs
@@ -22,7 +22,7 @@ namespace SixLabors
{
if (!value.GetType().GetTypeInfo().IsValueType)
{
- ThrowArgumentException("Type must be a struct.", parameterName);
+ ThrowHelper.ThrowArgumentException("Type must be a struct.", parameterName);
}
}
}
diff --git a/src/ImageSharp/ImageSharp.csproj b/src/ImageSharp/ImageSharp.csproj
index be0e9032b..7872bb5c5 100644
--- a/src/ImageSharp/ImageSharp.csproj
+++ b/src/ImageSharp/ImageSharp.csproj
@@ -37,6 +37,11 @@
+
+ True
+ True
+ Guard.Numeric.tt
+
True
True
@@ -202,6 +207,9 @@
DefaultPixelBlenders.Generated.cs
TextTemplatingFileGenerator
+
+ Guard.Numeric.cs
+
@@ -209,5 +217,4 @@
-
diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs
index 94127432b..8184f1577 100644
--- a/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs
+++ b/src/ImageSharp/PixelFormats/PixelBlenders/PorterDuffFunctions.Generated.cs
@@ -13,7 +13,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
-
///
/// Returns the result of the "NormalSrc" compositing equation.
///
@@ -419,7 +418,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
-
///
/// Returns the result of the "MultiplySrc" compositing equation.
///
@@ -825,7 +823,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
-
///
/// Returns the result of the "AddSrc" compositing equation.
///
@@ -1231,7 +1228,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
-
///
/// Returns the result of the "SubtractSrc" compositing equation.
///
@@ -1637,7 +1633,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
-
///
/// Returns the result of the "ScreenSrc" compositing equation.
///
@@ -2043,7 +2038,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
-
///
/// Returns the result of the "DarkenSrc" compositing equation.
///
@@ -2449,7 +2443,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
-
///
/// Returns the result of the "LightenSrc" compositing equation.
///
@@ -2855,7 +2848,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
-
///
/// Returns the result of the "OverlaySrc" compositing equation.
///
@@ -3261,7 +3253,6 @@ namespace SixLabors.ImageSharp.PixelFormats.PixelBlenders
return dest;
}
-
///
/// Returns the result of the "HardLightSrc" compositing equation.
///
diff --git a/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs b/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs
index 0b2274581..9ea6a305c 100644
--- a/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs
+++ b/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.Generic.cs
@@ -43,7 +43,7 @@ namespace SixLabors.ImageSharp.Tests
this.Collection.AddFrame((ImageFrame)null);
});
- Assert.StartsWith("Value cannot be null.", ex.Message);
+ Assert.StartsWith("Parameter \"frame\" must be not null.", ex.Message);
}
[Fact]
@@ -57,7 +57,7 @@ namespace SixLabors.ImageSharp.Tests
this.Collection.AddFrame(data);
});
- Assert.StartsWith("Value cannot be null.", ex.Message);
+ Assert.StartsWith("Parameter \"source\" must be not null.", ex.Message);
}
[Fact]
@@ -69,7 +69,7 @@ namespace SixLabors.ImageSharp.Tests
this.Collection.AddFrame(new Rgba32[0]);
});
- Assert.StartsWith("Value 0 must be greater than or equal to 100.", ex.Message);
+ Assert.StartsWith($"Parameter \"data\" ({typeof(int)}) must be greater than or equal to {100}, was {0}", ex.Message);
}
[Fact]
@@ -93,7 +93,7 @@ namespace SixLabors.ImageSharp.Tests
this.Collection.InsertFrame(1, null);
});
- Assert.StartsWith("Value cannot be null.", ex.Message);
+ Assert.StartsWith("Parameter \"frame\" must be not null.", ex.Message);
}
[Fact]
diff --git a/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.NonGeneric.cs b/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.NonGeneric.cs
index b0008d394..08e6f8e1f 100644
--- a/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.NonGeneric.cs
+++ b/tests/ImageSharp.Tests/Image/ImageFrameCollectionTests.NonGeneric.cs
@@ -90,7 +90,7 @@ namespace SixLabors.ImageSharp.Tests
this.Collection.AddFrame(null);
});
- Assert.StartsWith("Value cannot be null.", ex.Message);
+ Assert.StartsWith("Parameter \"source\" must be not null.", ex.Message);
}
[Fact]
@@ -114,7 +114,7 @@ namespace SixLabors.ImageSharp.Tests
this.Collection.InsertFrame(1, null);
});
- Assert.StartsWith("Value cannot be null.", ex.Message);
+ Assert.StartsWith("Parameter \"source\" must be not null.", ex.Message);
}
[Fact]