You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
Unable to write unit test for source generators due to a FileNotFoundException. The exception is being thrown because the unit test project is unable to locate SourceGenerator.Foundations.Contracts.dll. The current problem is that the only way to get this reference is to add the NuGet package <PackageReference Include="SourceGenerator.Foundations" Version="2.0.4" />. The issue is then the unit tests project won't build because it's not in fact a source generator.
AutoFactories.Tests.DiagnosticsTests.UntaggedClass
Source: DiagnosticsTests.cs line 19
Duration: 711 ms
Message:
System.IO.FileNotFoundException : Could not load file or assembly 'SourceGenerator.Foundations.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
Stack Trace:
AbstractTest.Compose(String source, Boolean verifyOutput, Action`1 assertDiagnostics)
AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
AbstractTest.Compose(String source, Boolean verifyOutput, Action`1 assertDiagnostics)
DiagnosticsTests.UntaggedClass() line 20
RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
Solution:
Create a publish just the contracts library by itself so unit tests can reference that and still compile.
The text was updated successfully, but these errors were encountered:
Description:
Unable to write unit test for source generators due to a
FileNotFoundException
. The exception is being thrown because the unit test project is unable to locateSourceGenerator.Foundations.Contracts.dll
. The current problem is that the only way to get this reference is to add the NuGet package<PackageReference Include="SourceGenerator.Foundations" Version="2.0.4" />
. The issue is then the unit tests project won't build because it's not in fact a source generator.Solution:
Create a publish just the contracts library by itself so unit tests can reference that and still compile.
The text was updated successfully, but these errors were encountered: