diff --git a/src/ApprovalTests.EntityFramework.Analyzers.Tests/EfQueryStandaloneMethodAnalyzerTests.cs b/src/ApprovalTests.EntityFramework.Analyzers.Tests/EfQueryStandaloneMethodAnalyzerTests.cs index 498043b..6a21bb9 100644 --- a/src/ApprovalTests.EntityFramework.Analyzers.Tests/EfQueryStandaloneMethodAnalyzerTests.cs +++ b/src/ApprovalTests.EntityFramework.Analyzers.Tests/EfQueryStandaloneMethodAnalyzerTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Immutable; +using System.IO; using System.Linq; using System.Threading.Tasks; using Microsoft.CodeAnalysis; @@ -24,8 +25,10 @@ internal static class Verifier { private static readonly ImmutableArray RuntimeReferences = ((string)AppContext.GetData("TRUSTED_PLATFORM_ASSEMBLIES")!) - .Split(';') - .Where(path => path.EndsWith(".dll", StringComparison.OrdinalIgnoreCase)) + .Split(Path.PathSeparator) + .Where(path => !string.IsNullOrWhiteSpace(path) && + path.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) && + File.Exists(path)) .Select(path => (MetadataReference)MetadataReference.CreateFromFile(path)) .Append(MetadataReference.CreateFromFile(typeof(Microsoft.EntityFrameworkCore.DbContext).Assembly.Location)) .ToImmutableArray(); diff --git a/src/ApprovalTests.EntityFramework.Analyzers.Tests/EfQueryableModelTypeAnalyzerTests.cs b/src/ApprovalTests.EntityFramework.Analyzers.Tests/EfQueryableModelTypeAnalyzerTests.cs index 2864e3d..3eeea9f 100644 --- a/src/ApprovalTests.EntityFramework.Analyzers.Tests/EfQueryableModelTypeAnalyzerTests.cs +++ b/src/ApprovalTests.EntityFramework.Analyzers.Tests/EfQueryableModelTypeAnalyzerTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Immutable; +using System.IO; using System.Linq; using System.Threading.Tasks; using Microsoft.CodeAnalysis; @@ -29,8 +30,10 @@ internal static class ModelTypeVerifier { private static readonly ImmutableArray RuntimeReferences = ((string)AppContext.GetData("TRUSTED_PLATFORM_ASSEMBLIES")!) - .Split(';') - .Where(path => path.EndsWith(".dll", StringComparison.OrdinalIgnoreCase)) + .Split(Path.PathSeparator) + .Where(path => !string.IsNullOrWhiteSpace(path) && + path.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) && + File.Exists(path)) .Select(path => (MetadataReference)MetadataReference.CreateFromFile(path)) .Append(MetadataReference.CreateFromFile(typeof(Microsoft.EntityFrameworkCore.DbContext).Assembly.Location)) .ToImmutableArray();