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
generate type forwards to ensure things work as expected in multi-targeting scenarios
Could you please elaborate a little bit more on this? What exact problem does it solve to add TypeForwardedTo attributes in target frameworks where the type exists?
For example, when multi-targeting net7.0;net6.0;netstandard2.0 the source generator produces this for .NET 6 and .NET 7 targets:
If I add <PolySharpExcludeTypeForwardedToDeclarations>true</PolySharpExcludeTypeForwardedToDeclarations> they are not generated and everything seems to work fine. Am I missing something?
The text was updated successfully, but these errors were encountered:
In case you generate attributes as public in lib A and have reference to them in another lib B (or generate as internal and use reflection).
With this attribute lib A will always have definition of IsExternalInitAttribute (real or forwarded). Without it, there is a possibility of TypeLoadException in some edge cases if A and B are updated separately, but I wold say in any sane deploy scheme this should not be a problem. Or maybe I missing something obvious.
Like if you publish lib A ver 1, but in ver 2 change PolySharp settings, so this type is no longer generated.
Lib B is transitive dep of app have dependency on A.v1, and app have direct dep on lib A.v2 -- assembly redirection would kick in and choose A.v2 and lib B will throw TypeLoadException.
In #86 you said
Could you please elaborate a little bit more on this? What exact problem does it solve to add
TypeForwardedTo
attributes in target frameworks where the type exists?For example, when multi-targeting
net7.0;net6.0;netstandard2.0
the source generator produces this for .NET 6 and .NET 7 targets:If I add
<PolySharpExcludeTypeForwardedToDeclarations>true</PolySharpExcludeTypeForwardedToDeclarations>
they are not generated and everything seems to work fine. Am I missing something?The text was updated successfully, but these errors were encountered: