"Length cannot be less than zero" error message

Sometimes I'm getting this error message when trying to decompile-and-navigate. It's annoying and cannot be closed.
Any ideas why?


Tagged:

Answers

  • Eddie DEddie D Posts: 1,780 Rose Gold 5
    Hi,

    In regards of .Net Reflector, I have never seen this error previously.  I suspect a value for a parameter was expected and none was received.

    What version of .Net reflector are you using?

    Are there any log files available, I believe they be accessible via the Help menu?  Are there any indications as to the object generating the reported error?

    Do you have security permissions to the object, libraries or components that you are attempting to analyse?

    Many Thanks
    Eddie


    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
  • fandreifandrei Posts: 12 Bronze 1
    Eddie D said:
    Hi,

    In regards of .Net Reflector, I have never seen this error previously.  I suspect a value for a parameter was expected and none was received.

    What version of .Net reflector are you using?

    Are there any log files available, I believe they be accessible via the Help menu?  Are there any indications as to the object generating the reported error?

    Do you have security permissions to the object, libraries or components that you are attempting to analyse?

    Many Thanks
    Eddie



    v10.2

    > Are there any log files available, I believe they be accessible via the Help menu?

    It's happening in the VS integration. How do I access the logs from there?

    > Do you have security permissions to the object, libraries or components that you are attempting to analyse?

    Do you mean filesystem permissions?

  • Russell DRussell D Posts: 1,324 Diamond 5
    %LOCALAPPDATA%\Red Gate\.NET Reflector\ is the location of the log file and should hopefully tell us what was the cause of the error.

    Additionally, what exactly were you doing when the error appeared? For example, did you use "Go To Decompiled Definition" option from the code area context menu, or did you press F12 on a code element, or has clicked something in one of .NET Reflector's tool windows (e.g. .NET Reflector Analyzer or .NET Reflector Object Browser)?

    Did the error appear when interacting with any specific assembly? If so, can you share that assembly to help us reproduce the issue?

    As for the reason for the dialog's invalid size, it might be related to system DPI settings (high DPI), so we may need to investigate it separately, what resolution/dpi are you using?

    Have you visited our Help Centre?
  • fandreifandrei Posts: 12 Bronze 1
    Russell D said:
    %LOCALAPPDATA%\Red Gate\.NET Reflector\ is the location of the log file and should hopefully tell us what was the cause of the error.

    There are lots of errors like the following in there, but nothing that says "Length cannot be less than zero"
    By the way, doesn't your telemetry report info about exceptions?

    05 Jun 2020 15:00:45.847 [112] WARN  RedGate.Reflector.VsPackage.Engine.IntegrationEngine - RedGate.Reflector.VsPackage.Engine.ReferenceException: The standard project reference Newtonsoft.Json has no location
       at RedGate.Reflector.VsPackage.Engine.IntegrationEngine.GetOurReferenceForReference(Reference reference, ProcessorArchitecture architecture)
       at RedGate.Reflector.VsPackage.Engine.IntegrationEngine.ProcessProjectReferences(Project project, Action`2 action, ProcessProjectReferencesOptions options, Action`1 failedToResolveAction)


    Additionally, what exactly were you doing when the error appeared? For example, did you use "Go To Decompiled Definition" option from the code area context menu, or did you press F12 on a code element, or has clicked something in one of .NET Reflector's tool windows (e.g. .NET Reflector Analyzer or .NET Reflector Object Browser)?
    It was happening when I was using F12 on a code element, but today another error happened when I tried to use the "Generate PDBs" feature, immediately when the dialog showed up. I managed to open the details using the hidden buttons on the error form:

    Object reference not set to an instance of an object.
    System.NullReferenceException
      at RedGate.Reflector.VsPackage.Engine.ModulesReader.ForLoadedModules(Action`2 assemblyAction, Action`3 pdbAction)
      at RedGate.Reflector.VsPackage.Gui.PdbGeneration.<>c__DisplayClass28_0.<SetUpDialogForAssemblyChoosing>b__2()"

    Did the error appear when interacting with any specific assembly? If so, can you share that assembly to help us reproduce the issue?
    No idea. Will contact you if I manage to pin it down.
    As for the reason for the dialog's invalid size, it might be related to system DPI settings (high DPI), so we may need to investigate it separately, what resolution/dpi are you using?

    Most likely. I have a 4k monitor and use 175% scaling. Also, the "Generate PDBs" dialog is shown partially off the screen when it opens.


  • fandreifandrei Posts: 12 Bronze 1
    Also, some assemblies are shown twice in the "Generate PDBs" dialog, the only difference is the case of their path. For instance, "C:\Windows\Microsoft.NET" and "C:\Windows\Microsoft.Net"


Sign In or Register to comment.