diff --git a/src/Lamar.Diagnostics/Lamar.Diagnostics.csproj b/src/Lamar.Diagnostics/Lamar.Diagnostics.csproj index e15858dd..6c8caaf4 100644 --- a/src/Lamar.Diagnostics/Lamar.Diagnostics.csproj +++ b/src/Lamar.Diagnostics/Lamar.Diagnostics.csproj @@ -2,7 +2,7 @@ Adds diagnostic checks to the command line of your Lamar-enabled ASP.Net Core app - 13.0.2 + 13.0.3 Jeremy D. Miller net6.0;net7.0;net8.0 portable diff --git a/src/Lamar.Microsoft.DependencyInjection/Lamar.Microsoft.DependencyInjection.csproj b/src/Lamar.Microsoft.DependencyInjection/Lamar.Microsoft.DependencyInjection.csproj index c83ab7dc..33945e89 100644 --- a/src/Lamar.Microsoft.DependencyInjection/Lamar.Microsoft.DependencyInjection.csproj +++ b/src/Lamar.Microsoft.DependencyInjection/Lamar.Microsoft.DependencyInjection.csproj @@ -1,7 +1,7 @@  Lamar Adapter for HostBuilder Integration - 13.0.2 + 13.0.3 Jeremy D. Miller net6.0;net7.0;net8.0 portable diff --git a/src/Lamar.Testing/IoC/Instances/ConstructorInstanceTests.cs b/src/Lamar.Testing/IoC/Instances/ConstructorInstanceTests.cs index 7dde3596..8f2f9999 100644 --- a/src/Lamar.Testing/IoC/Instances/ConstructorInstanceTests.cs +++ b/src/Lamar.Testing/IoC/Instances/ConstructorInstanceTests.cs @@ -6,6 +6,7 @@ using Lamar.IoC.Frames; using Lamar.IoC.Instances; using Lamar.IoC.Resolvers; +using Microsoft.CodeAnalysis.VisualBasic.Syntax; using Microsoft.Extensions.DependencyInjection; using NSubstitute; using Shouldly; @@ -277,6 +278,51 @@ public void resolve_from_scope_when_scoped_and_used_as_a_dependency() .ShouldBeOfType(); } + [Fact] + public void do_not_consider_guid_as_something_it_can_resolve() + { + var instance = new ConstructorInstance(typeof(GuyWithGuidConstructor), typeof(GuyWithGuidConstructor), ServiceLifetime.Singleton); + var theServices = new ServiceRegistry(); + theServices.AddSingleton(); + theServices.AddTransient(); + + var theGraph = new ServiceGraph(theServices, Scope.Empty()); + theGraph.Initialize(); + var ctor = instance.DetermineConstructor(theGraph, out var message); + ctor.ShouldNotBeNull(); + ctor.GetParameters().Any(x => x.ParameterType == typeof(Guid)).ShouldBeFalse(); + } + + public class GuyWithGuidConstructor + { + public GuyWithGuidConstructor(IWidget widget) + { + + } + + public GuyWithGuidConstructor(IWidget widget, Guid id) + { + + } + + public GuyWithGuidConstructor(IWidget widget, Guid id, Guid other) + { + + } + + public GuyWithGuidConstructor(Guid id, Guid other) + { + + } + } + + public class GuyWithOnlyGuids + { + public GuyWithOnlyGuids(Guid id, Guid other) + { + } + } + public class GuyWithMultipleConstructors { public GuyWithMultipleConstructors(IWidget widget, Rule rule) diff --git a/src/Lamar/Lamar.csproj b/src/Lamar/Lamar.csproj index b1673f55..ce0ce15f 100644 --- a/src/Lamar/Lamar.csproj +++ b/src/Lamar/Lamar.csproj @@ -1,7 +1,7 @@  Fast ASP.Net Core compatible IoC Tool, Successor to StructureMap - 13.0.2 + 13.0.3 Jeremy D. Miller net6.0;net7.0;net8.0 portable diff --git a/src/Lamar/Util/TypeExtensions.cs b/src/Lamar/Util/TypeExtensions.cs index ca7b40c4..c38985b2 100644 --- a/src/Lamar/Util/TypeExtensions.cs +++ b/src/Lamar/Util/TypeExtensions.cs @@ -16,6 +16,8 @@ internal static bool ShouldIgnore(this Type type) return true; } + if (type == typeof(Guid)) return true; + if (type.IsEnum) { return true;