Petr Onderka
MCMetalama Community
•Created by WiredWizard on 11/20/2023 in #technical-questions
Trying to override a method and pass an enum
Hi, we prefer using Slack now, see https://discord.com/channels/1108042639565127740/1108407291209842838/1164523200231772190.
Coincidentally (?), somebody just asked a very similar question there, I think that should answer your question: https://metalama.slack.com/archives/C03Q89ZGAQJ/p1700560350125159?thread_ts=1700514869.690389&cid=C03Q89ZGAQJ.
3 replies
MCMetalama Community
•Created by Whit on 10/6/2023 in #technical-questions
How to inject factory-based dependencies from method aspect into type?
It's possible and it's documented here: https://doc.metalama.net/conceptual/aspects/dependency-injection#implementing-an-adaptor-for-a-new-dependency-injection-framework.
Specifically, it would look like this (using 2023.4.3-preview):
3 replies
MCMetalama Community
•Created by Lance on 10/3/2023 in #technical-questions
IntroduceDependency with record types
Thanks for the report. This is a bug in Metalama. Can you create an issue on our GitHub (https://github.com/postsharp/Metalama/issues/new) for this?
5 replies
MCMetalama Community
•Created by Drago-QCC on 9/30/2023 in #technical-questions
Giving Aspects Metadata ?
If I understand you correctly, the simplest way to do this is to add the data to the aspect class:
If you want to keep it on another attribute, you can, by reading the attribute from your aspect:
6 replies
MCMetalama Community
•Created by Whit on 9/3/2023 in #technical-questions
Unable to get aspect testing to work
I have a fix for this that should be released in the 2023.3 RC release, which is planned for this week.
41 replies
MCMetalama Community
•Created by Whit on 9/3/2023 in #technical-questions
Unable to get aspect testing to work
I don't think so. It seems to be caused by our MSBuild customization. If build events happen in a different order, it doesn't generate assembly attributes that are needed by the test framework.
41 replies
MCMetalama Community
•Created by Whit on 9/3/2023 in #technical-questions
Unable to get aspect testing to work
Odd, that's not what I see. Anyway, I'll keep looking.
41 replies
MCMetalama Community
•Created by Whit on 9/3/2023 in #technical-questions
Unable to get aspect testing to work
I still don't understand the problem, but it seems a workaround is to run
dotnet test
from the command line once. After that, it seems running the tests from VS works.41 replies
MCMetalama Community
•Created by Whit on 9/3/2023 in #technical-questions
Unable to get aspect testing to work
Thanks, I get the exception now and will investigate what's causing it.
41 replies
MCMetalama Community
•Created by Whit on 9/3/2023 in #technical-questions
Unable to get aspect testing to work
Thanks.
41 replies
MCMetalama Community
•Created by Whit on 9/3/2023 in #technical-questions
Unable to get aspect testing to work
I'm still unable to reproduce this. Can you share the whole solution that contains the two projects?
41 replies
MCMetalama Community
•Created by Whit on 9/3/2023 in #technical-questions
Unable to get aspect testing to work
I understand that. But I assume it won't compile if you remove the
ProjectReference
.41 replies
MCMetalama Community
•Created by Whit on 9/3/2023 in #technical-questions
Unable to get aspect testing to work
Do you see the same exception if you remove the
ProjectReference
? (And do whatever you need to make the project compile without that.)41 replies
MCMetalama Community
•Created by Whit on 9/3/2023 in #technical-questions
Unable to get aspect testing to work
I was not able to reproduce this using xunit 2.5.1-pre.26. Can you share a project that reproduces the issue? (I suspect it's something in the .csproj.)
41 replies
MCMetalama Community
•Created by Whit on 8/29/2023 in #technical-questions
How to debug a "Cannot preview the transformed code: unknown error"?
Thank you for trying.
7 replies
MCMetalama Community
•Created by Whit on 8/29/2023 in #technical-questions
How to debug a "Cannot preview the transformed code: unknown error"?
Can you enable logging (see https://doc.metalama.net/conceptual/configuration/creating-logs) in the
RoslynCodeAnalysisService
process?7 replies
MCMetalama Community
•Created by Whit on 8/26/2023 in #technical-questions
Warn on ineligibility instead of throwing
You can keep the logic in the aspect, if you move it to
BuildAspect
and produce a diagnostic warning instead of failing eligibility.4 replies
MCMetalama Community
•Created by Whit on 8/1/2023 in #technical-questions
Referencing value assigned to variable in statement builder within another statement
I think you shouldn't, since you wouldn't be modifying any compile-time variables.
20 replies
MCMetalama Community
•Created by Whit on 8/1/2023 in #technical-questions
Referencing value assigned to variable in statement builder within another statement
Yeah, I think that would work better for you.
For example, this code:
generates:
20 replies
MCMetalama Community
•Created by Whit on 8/1/2023 in #technical-questions
Referencing value assigned to variable in statement builder within another statement
If you want to reference the variable you declared, you can do it by declaring
var abc = ExpressionFactory.Parse("abc");
and then using abc.Value
where you used just abc
previously.
Alternatively, I wonder if using Builder
just for the expression and letting Metalama manage the variable would work better. Let me check.20 replies