✅ 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.png20 Replies
But the XeniaBot.Data.dll that is in the XeniaBot.Core bin folder, doesn't have XeniaVersionService.how is it supposed to get there it feels lke the issue is just that you are looking at an old version
I'm directly referencing the
XeniaBot.Data
project in XeniaBot.Core
is XeniaBot.Core a library or an application
If I make changes somewhere else in
XeniaBot.Data
then check in XeniaBot.Core/bin/Deubg/net8.0/XeniaBot.Data.dll
, it shows
XeniaBot.Core
is a console application, XeniaBot.Data
is a class library.what do you mean by 'it shows'
I'll send screenshot
I'm using dotpeek to actually check if its included in the assembly
Made this change in
XeniaBot.Data/Services/BanSyncService.cs
, built the XeniaBot.Core
project, and this is inside of XeniaBot.Core/bin/Debug/net8.0/XeniaBot.Data.dll
https://res.kate.pet/upload/775bbcb063b0/dotPeek-232.0.20231101.171432_SS32Qf6KGo.pngbut the classes are not there?
Nope
All classes that aren't directly referenced, don't show when the
XeniaBot.Data
DLL is built for XeniaBot.Core
can you show the csproj for XeniaBot.Core and XeniaBot.Data
this is a little sus, do you know why it's there \
it seems bad that you are referencing two DLLs named XeniaBot.Data.dll which are seemingly not the same
I'm not sure why that's there at all tbh, because when I added the project reference, I used the GUI in Rider
if you delete it what happens
Checking rn
Yep, it shows now (and the breakpoint works)
Thank you
i am not sure how that was the cause of the issue, but i guess as long as it works it’s OK
From what I can tell it uses the DLL that was built by the web panel, which I last did about an hour ago (before XeniaVersionService existed)
i am not sure how your changes to the method would have shown up the n