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

  • Home
  • SEARCH
  • 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 7573847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:17:08+00:00 2026-05-30T16:17:08+00:00

I have some strange problem in my WPF app. I’m using a MVVM pattern

  • 0

I have some strange problem in my WPF app.
I’m using a MVVM pattern and this is the part of my MainWindowViewModel:

// GridView control in MainWindow.xaml binded to this property 
public DataTable DT
{
   get { return _dt; }
}

// INotifyPropertyChanged Member for refreshing bindings
public void OnPropertyChanged(string propertyName)
{
   if (PropertyChanged != null)
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}

// my function
void OnCreateTable()
{
   _dt = // creating new table here
    OnPropertyChanged("DT"); // refresh binding
}

When I call OnCreateTable() program almost allways hangs up with 100% CPU usage (sometimes with no CPU usage but others errors like incorrect data in GridView control).

While debugging I discovered some facts:

1) OnCreateTable() and data bindings work fine if make pause before OnPropertyChanged:

void OnCreateTable()
{
   _dt = // creating new table here
   Thread.Sleep(1000); //!!!
   OnPropertyChanged("DT"); // refresh binding
}

2) OnCreateTable() and data bindings work fine if trace it with “step over” (because this makes pause before OnPropertyChanged too)

I can’t understand why I need to make pause before OnPropertyChanged.

  • 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-05-30T16:17:09+00:00Added an answer on May 30, 2026 at 4:17 pm

    I think I found the problem. Sorry, I forgot that I have added the property name checking:

    public void OnPropertyChanged(string propertyName)
    {
       VerifyPropertyName(propertyName);
    
       if (PropertyChanged != null)
             PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    }
    
    [Conditional("DEBUG")]
        public void VerifyPropertyName(string propertyName)
        {
            // Verify that the property name matches a real,  
            // public, instance property on this object.
            if (TypeDescriptor.GetProperties(this)[propertyName] == null)
            {
                throw new Exception("Invalid property!");
            }
        }
    

    I can’t understand why, but calling VerifyPropertyName() needs a pause, or it results in that bug, I wrote.
    If I remove call to VerifyPropertyName() all works propertly!

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

Sidebar

Related Questions

I am using a WPF ribbon and I have just run into some strange
I have this very strange problem on a big flex app where it would
I have some strange linking problem in my Visual Studio 2005 C++ project. As
I have a strange problem with some documents on my webpage. My data is
I have a very strange problem. Under some elusive circumstances I fail to apply
I am having some strange problem and its really frustating me. I have a
I have a strange problem which I have been trying to fix for some
I have some strange problem with table in Firefox. What I want to create
I have a strange problem. I have a jQuery document.ready function executing some script
I have some strange problem,my code is NSLog(@A:%@,a); b=[NSString stringWithFormat:@1800-%@,a]; NSLog(@B:%@,b); The output is,

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.