Skip to content
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

Program Crashes on Startup with System.InvalidOperationException #18

Open
scottbright22 opened this issue Jan 5, 2024 · 0 comments
Open

Comments

@scottbright22
Copy link

Program is getting System.InvalidOperationException on my Kindle Scribe.
It seems like it's a threading problem and might need a semaphore.
Changing the timer to 10 seconds gets around the issue.

This Code Gets it to Work Again:

    private void CheckKindle()
    {
        CheckKindleType(); //New
        Timer aTimer = new(10000); //Changed
        aTimer.Elapsed += OnTimedEvent!;
        aTimer.AutoReset = true;
        aTimer.Enabled = true;
    }

System.InvalidOperationException
HResult=0x80131509
Message=Collection was modified; enumeration operation may not execute.
Source=System.Private.CoreLib
StackTrace:
at System.ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion()
at System.Collections.Generic.List`1.Enumerator.MoveNext()
at Kindle_Cover_Fixer_V2.MainWindow.IsOnKindleScribe() in D:\VS_Source\kindle-cover-fixer-main\Kindle Cover Fixer V2\LibraryCheckKindle.cs:line 60
at Kindle_Cover_Fixer_V2.MainWindow.IsOnKindlePreparation() in D:\VS_Source\kindle-cover-fixer-main\Kindle Cover Fixer V2\LibraryCheckKindle.cs:line 41
at Kindle_Cover_Fixer_V2.MainWindow.FindBooksTask() in D:\VS_Source\kindle-cover-fixer-main\Kindle Cover Fixer V2\FindBooks.cs:line 17
at System.Threading.Thread.StartHelper.Callback(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant