Why does this getter throw a StackOverflowException, but only when called from the same project?

I have several projects:

  • Database interface project that defines Thingo(basic solution)
  • A logical project that defines ThingoChooser(plugin solution)
  • A GUI project that references a logical project (plug-in solution
  • Testing project that references a logical project (plugin solution)

I am debugging the plugin, so I run the main solution with its current working directory set to the directory bin\Debugintended for all plugin projects. The main executable finds the plugin class in the GUI assembly and displays its main form.

In the test project, this code works fine:

this.chooser = new ThingoChooser();
foreach (var thingo in this.chooser.AvailableThingos) {
    Console.WriteLine(release);
}

, , StackOverFlowException, AvailableThingos.

ThingoChooser.AvailableThingos :

    public IEnumerable<Thingo> AvailableThingos {
        get {
            // Yes, it DEFINITELY case-matches the private variable,
            // NOT the public property. Oh, I wish this were that easy!
            return this.availableThingos;
        }

        private set {
            // ...
        }
    }

... IEnumerable<Thingo> this.availableThingos?

a List<Thingo>.

, WinForms, StackOverFlowException List<T>. :)

VS2008 this.availableThingos , . : StackOverFlowException, . .

, , , :

  • AvailableThingos List<Thingo>
  • var , .
  • public
  • List<T>
  • LINQBridge .NET 3.5

, . "Step Into" } , :

StackOverflowException

"System.StackOverflowException" mscorlib.dll

, .NET 3.5 LINQBridge List<Thingo> , WinForms:

List<Thingo> thingos = this.chooser.availableThingos.ToList();

: .ToList() List<Thingo> StackOverFlowException.

+3
1

.

GUI True. False. , Thingo DLL, GUI.

(, , : , DLL GUI. DLL .)

True. , , DLL .

, , StackOverflowException. DuplicateCopiesOfAssemblyYouDoofusException.

, :

( , GUI bin\Debug):

  • DLL , . , .

GUI ( ):

  • ref → : Local = True
  • ref → : Local = False

:

  • ref → : Local = False

:

  • ref → : Local = True
  • ref → : Local = True

, , , .

0

Source: https://habr.com/ru/post/1731862/


All Articles