question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

System.ArgumentOutOfRangeException

See original GitHub issue

Full error message:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentOutOfRangeException: InvalidArgument=Value of '23' is not valid for 'index'.
Parameter name: index
   at System.Windows.Forms.ListView.ListViewItemCollection.get_Item(Int32 index)
   at SteamBulkActivator.Result.responseTimer_Tick(Object sender, EventArgs e)
   at System.Windows.Forms.Timer.OnTick(EventArgs e)
   at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1586.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
SteamBulkActivator
    Assembly Version: 1.0.1.0
    Win32 Version: 1.0.1
    CodeBase: file:///E:/Downloads/SteamBulkActivator/SteamBulkActivator.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1586.0 built by: NETFXREL2
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1586.0 built by: NETFXREL2
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1586.0 built by: NETFXREL2
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1586.0 built by: NETFXREL2
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1586.0 built by: NETFXREL2
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1586.0 built by: NETFXREL2
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Steam4NET
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///E:/Downloads/SteamBulkActivator/Steam4NET.DLL
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Things I did prior to this exception occurring:

  1. Enter 23 valid keys, no invalid ones.
  2. Register all of them. One product was reported as already owned, so I left the results window open, searched for the key (third to last), clicked into the window, copied it and tried to activate it on Steam.
  3. Exception occurred. When clicking “Continue”, the exception is thrown again and again, making you have to quit the application.

If you need any more details on this, please let me know.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Ezzpifycommented, Mar 7, 2017

Good hunting! The program is indeed receiving callbacks even when you interact with the client manually.

Changing the following function to the following should fix this issue!

public void AddResult(string result)
{
    //This now means that we will ignore any results if we get more results than keys.
    //If we start off with 10 keys, it does NOT make sense to get 11 responses!
    if (_cdKeyList.Count() < _cdKeyResponses.Count() + 1)
        return;

    _cdKeyResponses.Add(new KeyResponse()
    {
        response = result,
        added = false
    });
}

In addition we will also disable the timer once the program is done registering the keys. This will also get rid of dirty Invoke call.

private void responseTimer_Tick(object sender, EventArgs e)
{
    for (int i = 0; i < _cdKeyResponses.Count; i++)
    {
    ...
    
    if (Completed)
    {
        panelBtnRegisterWrapper.Visible = true;
        responseTimer.Stop();
    }
}

Also disabling the callback entirely after we’re done registering the keys will also work. Hehe.

1reaction
Ditti4commented, Mar 7, 2017

Alright, I got it!

What’s happening is that when I manually register a key, I think the Bulk Activator still gets the result message from the Steam Client and tries to add it to the result window.

What I did just now (tried it multiple times to confirm it):

  1. “Register” 3 keys (already registered)
  2. Leave the result window open
  3. Register the key through Steam
  4. Exception occurred

Your application probably tries to find the associated key in the main window which isn’t there since it was registered through the Steam Client.

I hope that helps now!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ArgumentOutOfRangeException Class (System)
An ArgumentOutOfRangeException exception is thrown when a method is invoked and at least one of the arguments passed to the method is not...
Read more >
C# Exception Guide: ArgumentOutOfRangeException
The ArgumentOutOfRangeException exception is thrown when the argument passed to a method is not null and contains a value that is not within...
Read more >
c# System.ArgumentOutOfRangeException
I'm making program that sends email with some data. I know that the System.ArgumentOutOfRangeException exception means that number in the array/ ...
Read more >
ArgumentOutOfRangeException in C# with Examples
In c#, ArgumentOutOfRangeException is an exception that will occur when the value of an argument falls outside the allowable range of values ...
Read more >
Type: System.ArgumentOutOfRangeException
ArgumentOutOfRangeException is thrown when a method is invoked and at least one of the arguments passed to the method is not null and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found