C#C
C#2y ago
kate!

✅ Unreferenced classes not being included

How I have my codebase setup for reflection is to get all types that have a specific attribute (XeniaControllerAttribute) and extend a specific class (BaseService), it then creates an instance of all of those types found and calls a method on it.

When I do that, it seems like classes that aren't referenced don't get called, and aren't even included in the main project (XeniaBot.Core) when compiling. Even the breakpoint doesn't work.

Currently I have the debugger broken on the method that's called on one of those classes XeniaVersionService.InitializeAsync() and it never gets called. Hell, the breakpoint doesn't even work.
https://res.kate.pet/upload/dda1477d3f2e/rider64_fz1KLaArzx.png

When I add a breakpoint into my function that fetches all the services to load, it doesn't show XeniaVersionService at all when fetching all the types for the assembly that XeniaVersionService is in.
https://res.kate.pet/upload/0471946350b5/eQHcs2gxgy.png

I've disassembled the XeniaBot.Data library by itself and it includes the XeniaVersionService.
https://res.kate.pet/upload/d45c9de1d711/dotPeek-232.0.20231101.171432_GRKD9P5Alc.png

But the XeniaBot.Data.dll that is in the XeniaBot.Core bin folder, doesn't have XeniaVersionService.
https://res.kate.pet/upload/f18fa620b99d/dotPeek-232.0.20231101.171432_VAkXvaFiZC.png
Was this page helpful?