Forum

Exception when opening a project referencing a csproj

Hey there,

Was working on a project referencing a csproj on 2022.5.0 - 0379. After closing and re-opening vvvv, I was greeted with this error message :

EmitException: "D:\Documents\dev\projects\foo\bar\collector\Collector.vl.cs(50,71): error CS0012: The type 'DirectusMetric' is defined in an assembly that is not referenced. You must add a reference to assembly 'Collector#1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'."
Full stack trace
EmitException: "D:\Documents\dev\projects\foo\bar\collector\Collector.vl.cs(50,71): error CS0012: The type 'DirectusMetric' is defined in an assembly that is not referenced. You must add a reference to assembly 'Collector#1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'."
    StackTrace:
        VL.Lang.Platforms.Roslyn.TargetCompilation+<>c__DisplayClass49_0 { internal System.ValueTuple<Microsoft.CodeAnalysis.AssemblyMetadata, VL.Core.RawAssembly> <Emit>g__EmitDebug|0() { ... } } 
        VL.Lang.Platforms.Roslyn.TargetCompilation { private System.ValueTuple<Microsoft.CodeAnalysis.PortableExecutableReference, VL.Core.RawAssembly> Emit(VL.Lang.Symbols.IProjectSymbol project, Microsoft.CodeAnalysis.CSharp.CSharpCompilation compilation, bool isDebug, bool includeSource, System.Threading.CancellationToken token) { ... } } 
        VL.Lang.Platforms.Roslyn.TargetCompilation+<>c__DisplayClass6_0 { internal VL.Lang.Platforms.Roslyn.ProjectCompilation <InitializeAsync>g__Build|0(VL.Lang.Platforms.Roslyn.ProjectBuildRequest projectBuildRequest) { ... } } 
        VL.Lang.Platforms.Roslyn.TargetCompilation+<>c__DisplayClass6_1+<<InitializeAsync>b__3>d { private virtual void MoveNext() { ... } } 
        System.Runtime.ExceptionServices.ExceptionDispatchInfo { public void Throw() { ... } } 
        System.Runtime.CompilerServices.TaskAwaiter { private static void ThrowForNonSuccess(System.Threading.Tasks.Task task) { ... } } 
        System.Runtime.CompilerServices.TaskAwaiter { private static void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task) { ... } } 
        VL.Lang.Platforms.Roslyn.TargetCompilation+<InitializeAsync>d__6 { private virtual void MoveNext() { ... } } 
        System.Runtime.ExceptionServices.ExceptionDispatchInfo { public void Throw() { ... } } 
        System.Runtime.CompilerServices.TaskAwaiter { private static void ThrowForNonSuccess(System.Threading.Tasks.Task task) { ... } } 
        System.Runtime.CompilerServices.TaskAwaiter { private static void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task) { ... } } 
        System.Runtime.CompilerServices.TaskAwaiter`1 { public TResult GetResult() { ... } } 
        VL.Lang.Platforms.Roslyn.TargetCompilation+<CreateAsync>d__4 { private virtual void MoveNext() { ... } } 
        System.Runtime.ExceptionServices.ExceptionDispatchInfo { public void Throw() { ... } } 
        System.Runtime.CompilerServices.TaskAwaiter { private static void ThrowForNonSuccess(System.Threading.Tasks.Task task) { ... } } 
        System.Runtime.CompilerServices.TaskAwaiter { private static void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task) { ... } } 
        System.Runtime.CompilerServices.TaskAwaiter`1 { public TResult GetResult() { ... } } 
        VL.Lang.Platforms.Roslyn.TargetCompilation+<WithCompilationAsync>d__45 { private virtual void MoveNext() { ... } } 
        System.Runtime.ExceptionServices.ExceptionDispatchInfo { public void Throw() { ... } } 
        System.Runtime.CompilerServices.TaskAwaiter { private static void ThrowForNonSuccess(System.Threading.Tasks.Task task) { ... } } 
        System.Runtime.CompilerServices.TaskAwaiter { private static void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task) { ... } } 
        System.Runtime.CompilerServices.TaskAwaiter`1 { public TResult GetResult() { ... } } 
        VL.Lang.Platforms.Roslyn.TargetCompilation+<VL-Lang-Symbols-ITargetCompilation-WithCompilationAsync>d__46 { private virtual void MoveNext() { ... } } 
        System.Runtime.ExceptionServices.ExceptionDispatchInfo { public void Throw() { ... } } 
        System.Runtime.CompilerServices.TaskAwaiter { private static void ThrowForNonSuccess(System.Threading.Tasks.Task task) { ... } } 
        System.Runtime.CompilerServices.TaskAwaiter { private static void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task) { ... } } 
        System.Runtime.CompilerServices.TaskAwaiter`1 { public TResult GetResult() { ... } } 
        VL.Model.VLSession+<CreateTargetCompilationAsync>d__168 { private virtual void MoveNext() { ... } } 
        System.Runtime.ExceptionServices.ExceptionDispatchInfo { public void Throw() { ... } } 
        System.Runtime.CompilerServices.TaskAwaiter { private static void ThrowForNonSuccess(System.Threading.Tasks.Task task) { ... } } 
        System.Runtime.CompilerServices.TaskAwaiter { private static void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task) { ... } } 
        VL.Model.VLSession+<UpdateRuntimesAsync>d__167 { private virtual void MoveNext() { ... } } 
        System.Runtime.ExceptionServices.ExceptionDispatchInfo { public void Throw() { ... } } 
        System.Runtime.CompilerServices.TaskAwaiter { private static void ThrowForNonSuccess(System.Threading.Tasks.Task task) { ... } } 
        System.Runtime.CompilerServices.TaskAwaiter { private static void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task task) { ... } } 
        VL.Model.VLSession+<UpdateCompilationAsync>d__190 { private virtual void MoveNext() { ... } } 

Thing is, the csproj is still referenced, and the patch correctly “sees” this DirectusMetric type and its operations.

Cheers

Ok, after trying to export this project, the exporter raised an error complaining that the solution’s name was ambiguous : indeed, my patch was called Collector.vl and the solution’s name was Collector as well.

Does not seem to complain anymore.