AOP Methods–Problems in running and solving
The problems that I have encountered were:
1. The ThisAssembly RoslynGenerator that I use should not be put as reference in the nuget. I have fixed this by adding
<PackageReference Include=”ThisAssembly.AssemblyInfo” Version=”1.0.0″ ReferenceOutputAssembly=”false” />
2. I have problems generating code to async code with Task . The problem was that I have added logging ( very basic – Console.WriteLine) and the order of the logging was errating. I figured out that I should must use the async /await and then my template was modified as
strAwait = “”
strAsync =””
if mi.IsAsync == true
strAwait = ” await “
strAsync = ” async “
endpublic {{strAsync}} {{mi.ReturnType}} {{mi.NewName}} ({{mi.parametersDefinitionCSharp }} {{separator}}
//more code
{{
if mi.ReturnsVoid == false
}}
return
{{
end
}}
{{ strAwait }}{{mi.Name}}({{ mi.parametersCallCSharp }});
And this is worth noting.
Leave a Reply