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 9137189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:04:15+00:00 2026-06-17T09:04:15+00:00

My demo application implements the MVVM pattern in a WPF project. The ViewModel calls

  • 0

My demo application implements the MVVM pattern in a WPF project. The ViewModel calls a remote webservice via a service agent (proxy) like this:

proxy.GetProjectList((sender, e) => this.ProjectList, username, password);

ProjectList is a property defined in the ViewModel. It holds an array of CProject objects. The view binds to this property to display the project names. Basically this works fine.

However I get a NullReferenceException if I add the following if-statement:

proxy.GetProjectList((sender, e) => this.ProjectList = e.Result, username, password);
if (ProjectList.Length > 0) doSomething();

Debugging the application shows that the ProjectList property is null after the webservice has been called. And I just dont’t know why.

The webservice call above is implemented as follows:

public void GetProjectList(EventHandler<getProjectListCompletedEventArgs> callback, string username, string password) {
  proxy.getProjectListCompleted += callback;
  proxy.getProjectListAsync(username, password);
}
  • 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-17T09:04:16+00:00Added an answer on June 17, 2026 at 9:04 am

    Following the hint from HighCore I changed my implementation to the following.

    Calling the operation from the client:

    proxy.GetProjectList(GetProjectListCallback, Username, SecurePassword);
    

    Adding the callback method before:

    private void GetProjectListCallback(object sender, getProjectListCompletedEventArgs e) {
      ProjectList = e.Result;
      if (ProjectList != null) {
        if (ProjectList.Length > 0) doSomething();
      }
    }
    

    Calling the actual webservice operation in a seperate service agent:

    public void GetProjectList(getProjectListCompletedEventArgs callback, string username, SecureString password) {
      proxy.getProjectListCompleted += callback;
      proxy.getProjectListAsync(username, password);
    }
    

    I don’t know if this is a good programming style but it works 🙂

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

Sidebar

Related Questions

I'm trying to implement the MVVM pattern in WPF. I've followed Jeremy Alles's Very
I've been trying to expand Josh Smith's demo MVVM application in order to better
I am trying to run a demo application for OSGi EventAdmin service, but the
I want to implement the Demo shown at http://tablesorter.com/docs/example-pager.html in a mobile application. I
I have one demo application to check select for update query public class Test
i have created a demo application Using JSF & EJB 3.0 (Stateless session bean
I'm unit testing a demo application, which is a POP3 client. The POP3 client
I am currently putting together a demo application that needs to show 28,000 markers
I want to modify the existing Android demo application 3D Rubik cube that uses
I would like to set up a very simple demo application that includes LINQ

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.