Solution Wide Analysis and Source Generators Follow
I use Source Generators to implement Aspect Oriented Programming via Proxy Pattern.
The Souce Generator I use works fine, and program compiles... but Solution Wide Analysis seems not to know there are automatic generated sources (as partial classes) and complains with a lot of errors.
Example:
I use nuget package Rop.ProxyGenerator
Example:
[ProxyOf("IHasOut","_controlIHasOut")]
public partial class WithHasOut : BaseControl, IHasOut
{
private HasOutAop _controlHasOutAop=new HasOutAop();
}
Rop.ProxyGenerator generates automatically the AOP methods and properties using Proxy Pattern:
// Autogenerated code for Proxy class
namespace Test.Winforms
{
public partial class ConUnOut
{
public virtual bool TryGetValue(int key, int value)
{
return _controlIHasOut.TryGetValue(key, value);
}
}
}
But Solution Wide Analysis doens't read this code, and complains that TryGetValue is not defined.
But I don't want to turn off Solution Wide Analysis...
Any solution?
Please sign in to leave a comment.
Hello ramon, thank you for your question. Could you please check if you have a "pause" icon above the vertical scrollbar in the file with autogenerated code?
I'm also getting the same issues with solution wide analysis and source generated code, for example, while using nuget package OneOf.SourceGenerator
Which generates the corresponding code
In Visual Studio Code there is no error.
Also there is no pause icon above the vertical scroll bar on the generated code
Hello Iskander Sierra, thank you for your message.
Do I understand correctly that somewhere in other files you are getting a red code because of this? Do you have a chance to share a small sample solution so that we can reproduce the problem on our side? You can upload solution to JB server via https://uploads.jetbrains.com/ form.
Do I understand correctly that Visual Studio builds this solution without any problems?
Thank you!