From 65bab587afc3f630cd5333ba83880c4f9f49e89d Mon Sep 17 00:00:00 2001 From: Egil Hansen Date: Mon, 20 Nov 2023 19:49:05 +0000 Subject: [PATCH] fix: make AngleSharp.dll lookup OS agnostic --- src/bunit.web.anglesharp/WrapperElementsGenerator.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bunit.web.anglesharp/WrapperElementsGenerator.cs b/src/bunit.web.anglesharp/WrapperElementsGenerator.cs index da48ff273..8446b6dad 100644 --- a/src/bunit.web.anglesharp/WrapperElementsGenerator.cs +++ b/src/bunit.web.anglesharp/WrapperElementsGenerator.cs @@ -76,7 +76,12 @@ private static void GenerateWrapperFactory(StringBuilder source, IEnumerable FindElementInterfaces(Compilation compilation) { - var meta = compilation.References.First(x => x.Display?.EndsWith("\\AngleSharp.dll") ?? false); + var meta = compilation.References.FirstOrDefault(x => x.Display?.EndsWith($"{Path.PathSeparator}AngleSharp.dll") ?? false); + + if (meta is null) + { + throw new InvalidOperationException($"AngleSharp.dll not found. References: {string.Join(",", compilation.References.Select(x => x.Display))}"); + } var angleSharpAssemblySymbol = compilation.GetAssemblyOrModuleSymbol(meta) as IAssemblySymbol; var htmlDomNameSpace = angleSharpAssemblySymbol