In general, I ran into a NullReferenceException and, as a result of (lengthy) debugging, I found out that the ComboBox.SelectionChanged event handler calls the handler method when the application starts.
ComboBox markup:
<ComboBox x:Name="comboBox" HorizontalAlignment="Right" Margin="5" VerticalAlignment="Top" Width="150" SelectedIndex="0" SelectionChanged="comboBox_SelectionChanged"> In theory, this should not be, or am I mistaken? If you need any parts of the program code, write, I will answer.
var a=42;, but somewhere that does not work. If you need other parts - write, I will answer. - tym32167ComboBox.SelectionChangedhandler should only be called when the reference to the selected item in the combo box changes. It has nothing to do with the fact that the application has started. - tym32167SelectedIndex="0", or maybe not. Put a breakpoint inside the handler and see the call stack. - tym32167