The program '{prgrmnm}' has exited with code -2147023895 (0x800703e9)

0

Most probably this is a something really simple, but I don't really understand it right now:

I have some interface definition and some base implementation like:

    public interface IA
    {
        IB B { set; get; }
    }

    public interface IB
    {
        IA A { set; get; }
    }

    public class TheA<T> : NotifyPropertyChangedBase, IA
    {
        public TheA()
        {
            var t = typeof(T);
        }

        public IB B { set; get; }
    }

    public class TheB : NotifyPropertyChangedBase, IB
    {

        public TheB(IA a)
        {
            A = a;
        }

        public IA A { set; get; }
    }

I get this error message with the exit code 0x800703e9, when I using those classes under Visual Studio (2015 Update 3, for the reason it is a debugger issue, project and build info: .Net fw. 4.5.2, debug, x86) like here:

    static void Main(string[] args)
    {
        var a = new TheA<int>();
        a.B = new TheB(a); // After this line the program fails, while debugging.
    }

I have added the generics tag to this question because this error only appeared after I have added the generic parameter.

Question: What causes the "The program '{prgrmnm}' has exited with code -2147023895 (0x800703e9)." error in this example?

Update: This error should be a Visual Studio environment bug. Since the code itself runs. It fails only if VS tries to evaluate the instance a.

Update II: First I thought there is no relevance of the inheritance, since there was no direct call, but the debugger called it.

    public abstract class NotifyPropertyChangedBase : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        public override string ToString()
        {
            var s = new StringBuilder();

            foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(this))
            {
                string name = descriptor.Name;
                object value = descriptor.GetValue(this);
                s.AppendLine(string.Format("{0}={1}", name, value)); // This calls recursively itself... Ok 
            }
            return s.ToString();
        }
    }

Thanks for talking though.

c#
generics
runtime-error
asked on Stack Overflow Sep 27, 2017 by minus one • edited Sep 27, 2017 by minus one

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0