Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9183467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:48:35+00:00 2026-06-17T18:48:35+00:00

I created and initialized quite a large Dictionary and got this error when starting

  • 0

I created and initialized quite a large Dictionary and got this error when starting the application:

An unhandled exception of type 'System.Windows.Markup.XamlParseException' occurred in      PresentationFramework.dll

Additional information: Zeilennummer "3" und Zeilenposition "9" von "Durch den Aufruf des     
Konstruktors für Typ "AbiZeitung.MainWindow", der den angegebenen Bindungseinschränkungen 
entspricht,    wurde eine Ausnahme ausgelöst.".

If there is a handler for this exception, the program may be safely continued.

Here is a part of the Dictionary:

Dictionary<string, string> teacherList = new Dictionary<string, string>()
    {
        {"Mr", "M"},
        {"Mr", "D"},
        {"Mr", "S"},
        {"Mr", "W"}
    };

Any guess why this happens?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:48:37+00:00Added an answer on June 17, 2026 at 6:48 pm

    A Dictionary<T,U> needs to have unique keys. Right now, your collection initializer will raise an exception (ArgumentException) when it tries to add {"Mr","D"}, as “Mr” is already a key.

    For details, see Dictionary.Add, under exceptions:

    ArgumentException: An element with the same key already exists in the Dictionary.

    If your View creates this dictionary, even indirectly (ie: it’s in a ViewModel generated from the xaml), you’ll get an exception, which in turn will cause the XamlParseException to occur.

    If you need a collection like this, I recommend making an ObservableCollection<T> (or List<T> if this won’t change) of a custom type which contains the two strings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created the button in the main.xml file and initialized it in the activity
I am new to Knockout.js, I have created an observable array and initialized with
My JSP-application requires some configuration; so I created the Settings class which is a
This question came to my mind quite a few times. Let my explain my
I've created a custom message type for use in resizing my Window , called
I compiled this code and the 99th threads that it's been created keeps creating
In an application (OS X 10.6.7) I have a NSWindowController subclass which is initialized
After breaking my head over this for quite sometime, I am looking for help.
I have found this site quite useful to a lot of issues I run
I've recently created a new class for my iPhone application which will hold information

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.