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
usingSystem.Diagnostics.CodeAnalysis;namespaceOtherLib{publicreadonlystructMyParsable:IParsable<MyParsable>{publicstaticMyParsableParse(strings)=>thrownewNotImplementedException();publicstaticboolTryParse([NotNullWhen(true)]string?s,[MaybeNullWhen(false)]outMyParsableresult)=>thrownewNotImplementedException();publicstaticMyParsableParse(strings,IFormatProvider?provider)=>thrownewNotImplementedException();publicstaticboolTryParse([NotNullWhen(true)]string?s,IFormatProvider?provider,[MaybeNullWhen(false)]outMyParsableresult)=>thrownewNotImplementedException();// workaround of #52publicstaticMyParsableParse(ReadOnlySpan<byte>s,IFormatProvider?provider)=>thrownewNotImplementedException();publicstaticboolTryParse([NotNullWhen(true)]ReadOnlySpan<byte>s,IFormatProvider?provider,[MaybeNullWhen(false)]outMyParsableresult)=>thrownewNotImplementedException();}[UnitGenerator.UnitOf(typeof(MyParsable),UnitGenerator.UnitGenerateOptions.ParseMethod)]publicreadonlypartialstructStructInOtherLib{publicstaticvoidTest()=>StructInOtherLib.Parse("",null);// no error}}
ConsoleApp:
OtherLib.StructInOtherLib.Test();StructOutOfOtherLib.Test();[UnitGenerator.UnitOf(typeof(OtherLib.MyParsable),UnitGenerator.UnitGenerateOptions.ParseMethod)]publicreadonlypartialstructStructOutOfOtherLib{publicstaticvoidTest()=>StructOutOfOtherLib.Parse("",null);// error CS1501: No overload for method 'Parse' takes 2}
UnitOf with ParseMethod option does not accept the type declared in other assemblies.
A solution has 2 projects:
OtherLib:
ConsoleApp:
The generated code displayed on IDE(VS17.10.5):
The generated code emitted by using
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
:The text was updated successfully, but these errors were encountered: