Skip to content

Commit

Permalink
Replaced SingleOrDefault with Any (#3224)
Browse files Browse the repository at this point in the history
I've encountered a case when SingleOrDefault() (at line #38) throws `InvalidOperationException` due to finding more than one assembly item in the collection.
  • Loading branch information
AgentFire committed Oct 1, 2021
1 parent 6aa2782 commit ae1d042
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Source/LinqToDB.Templates/LinqToDB.Tools.ttinclude
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ public static string GetProviderToolsPath(string assemblyName, string fullName)
public static void LoadAssembly(string assemblyName, string toolsPath)
{
// check if already loaded
if (AppDomain.CurrentDomain.GetAssemblies().SingleOrDefault(a => a.GetName().Name == assemblyName) != null)
if (AppDomain.CurrentDomain.GetAssemblies().Any(a => a.GetName().Name == assemblyName))
return;

try
{
// try to load using VS (host) lookup paths
Expand Down

0 comments on commit ae1d042

Please sign in to comment.