-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GetAssemblyByName Bug - Sequence contains more than one matching element #1
Comments
I just tested 1.3.2 before I pushed it to the TS and did not notice this in my log. I just now booted the game up and let it idle for a minute or two on the main menu and my player.log does not contain the word "warning" at all. The only time I log a warning in the whole project is when the processor is busy so I dunno how you got this message or where to start working on it. |
No...I added it so I could see what duplicates it was complaining about. Using SingleOrDefault when there is more than one result (why there is more than one, I haven't looked too deeply) is the cause of the exception. The code in the "Replacement Code" box resolves the issue. |
Your error message can't exist in either our, nor your code. Your code shows "Found Assembly" printing both the name and location of each Neither the original nor replacement code could possibly result in the screenshot provided. This means your installation specifically has two Assembly which call themselves Thank you for pointing this out. 2c2
< SingleOrDefault(assembly => assembly.GetName().Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));
---
> FirstOrDefault(assembly => assembly.GetName().Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)); |
As you can see from the thread, I added the logging specifically to capture the assemblies being found. The screenshot was taken before I updated the code to display the locations. The line below is what produces the output shown in the screenshot: Plugin.Log.LogWarning($"Found assembly: {assembly}"); I added the location because I too suspected I had a duplicate assembly, but of the two found, one assembly had a location, and one didn't. Regardless, FirstOrDefault resolves it either way. Hopefully, this explanation resolves any confusion. |
Using this plugin for Cult of the Lamb - but it was erroring every exception due to it finding multiple of the same assembly name.
Original code:
Replacement code:
The text was updated successfully, but these errors were encountered: