Crashing the app dotnet.exe when a reference to a variable, wut?

Good day! I'm probably just something simple I missed, but I was plagued by doubts.
And so what's the problem. Is the property
short BaseGene<short>.Code { get; set; }</short>

It seems there's no catch, but if you spend any manipulations with unit testing with property, for example:
Assert.IsNotNull(gene.Code);
the dotnet says: "I'm outta here: 0xc00000fd" and in console says "Process is terminating due to StackOverflowException.".

hetero and cetery:
public T Code { get => Code; set => Code = value; }


I don't understand where overflow occurs understand would be an infinite loop, but no...
Even if:
GeneInt16 gene = new GeneInt16();
Assert.IsNotNull(gene);

And in the constructor
public GeneInt16(int? seed = null, short min = short.MinValue, short max = short.MaxValue)
{
 _random = (seed == null) ? new Random() : new Random((int)seed);
 Code = (short)_random.Next(min, max);
}


The same thing happens.
If at all, to ignore the existence of the Code, all OK, the tests passed.
Important note, if you just compile the project and use it, everything is fine.
June 8th 19 at 16:33
1 answer
June 8th 19 at 16:35
Solution
understand it would be an infinite loop

Code {get{return Code;}}
just replace the Code {get;set;} - Alize_Moen commented on June 8th 19 at 16:38
Incredibly, worked. Can help to explain what is the problem? Or where to go to read? - nikita.Stracke commented on June 8th 19 at 16:41
and God, all I knew, it was all so obvious. - nikita.Stracke commented on June 8th 19 at 16:44

Find more questions by tags C#.NETModular testing