Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a NullReferenceException in ExplorerBrowser by adjusting the order of static readonly fields. #61

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@ namespace Microsoft.WindowsAPICodePack.Controls.WindowsPresentationFoundation
/// <summary>Interaction logic for ExplorerBrowser.xaml</summary>
public partial class ExplorerBrowser : UserControl, IDisposable
{
private static readonly DependencyPropertyKey ItemsPropertyKey =
DependencyProperty.RegisterReadOnly(
"Items", typeof(ObservableCollection<ShellObject>),
typeof(ExplorerBrowser),
new PropertyMetadata(null));

private static readonly DependencyPropertyKey NavigationLogPropertyKey =
DependencyProperty.RegisterReadOnly(
"NavigationLog", typeof(ObservableCollection<ShellObject>),
typeof(ExplorerBrowser),
new PropertyMetadata(null));

private static readonly DependencyPropertyKey SelectedItemsPropertyKey =
DependencyProperty.RegisterReadOnly(
"SelectedItems", typeof(ObservableCollection<ShellObject>),
typeof(ExplorerBrowser),
new PropertyMetadata(null));

/// <summary>The items in the ExplorerBrowser window</summary>
public static readonly DependencyProperty ItemsProperty = ItemsPropertyKey.DependencyProperty;

Expand Down Expand Up @@ -185,24 +203,6 @@ public partial class ExplorerBrowser : UserControl, IDisposable
typeof(ExplorerBrowser),
new PropertyMetadata(ExplorerBrowserViewMode.Auto, OnViewModeChanged));

private static readonly DependencyPropertyKey ItemsPropertyKey =
DependencyProperty.RegisterReadOnly(
"Items", typeof(ObservableCollection<ShellObject>),
typeof(ExplorerBrowser),
new PropertyMetadata(null));

private static readonly DependencyPropertyKey NavigationLogPropertyKey =
DependencyProperty.RegisterReadOnly(
"NavigationLog", typeof(ObservableCollection<ShellObject>),
typeof(ExplorerBrowser),
new PropertyMetadata(null));

private static readonly DependencyPropertyKey SelectedItemsPropertyKey =
DependencyProperty.RegisterReadOnly(
"SelectedItems", typeof(ObservableCollection<ShellObject>),
typeof(ExplorerBrowser),
new PropertyMetadata(null));

private readonly DispatcherTimer dtCLRUpdater = new DispatcherTimer();

private readonly ObservableCollection<ShellObject> items;
Expand Down