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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:48:30+00:00 2026-05-25T23:48:30+00:00

I want to access WMI using the AutomationFactory in a Silverlight OOB application. dynamic

  • 0

I want to access WMI using the AutomationFactory in a Silverlight OOB application.

dynamic locator = AutomationFactory.CreateObject("WbemScripting.SWbemLocator");
dynamic wmi = locator.ConnectServer(".", "\\root\\cimv2");

I now want to add error handling to this.

MSDN states that the return value is a reference to the connected object if the call is successful and that in case of an error I should check the Err object. However, there are two questions I have with this:

  • What is the return value if the call is not successful? null? Some arbitrary pointer that I cannot use?
  • How can I access the Err object in Silverlight?
  • How can I detect if the call was successful? May there be any exceptions which I have to catch?
  • I’ve seen some examples using the using statement, and some without. Do I have to dispose the dynamic objects manually after I’ve used them?
  • 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-25T23:48:30+00:00Added an answer on May 25, 2026 at 11:48 pm
    • What is the return value if the call is not successful? null? Some arbitrary pointer that I cannot use?

    No value is return and the LHS of an assignment is unmodified when a call into a COM component fails. Instead the COMException is thrown.

    • How can I access the Err object in Silverlight?

    This is no “Err” object, that is a VB(Script) construct, it doesn’t exist in C#. However the infor you are after will be available as the properties of the COMException thrown when a call fails.

    • How can I detect if the call was successful? May there be any exceptions which I have to catch?

    Yup, see above.

    • I’ve seen some examples using the using statement, and some without. Do I have to dispose the dynamic objects manually after I’ve used them?

    Attempts to manage COM object lifetimes using Dispose have varied results. Personally I’d make sure that anything that has something like a “Close” method has that “Close” method call and leave it at that.

    If you really want to make user COM objects are released then at an appropriate point (and not too frequently) call GC.Collect.

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

Sidebar

Related Questions

I have a Silverlight application using C#, with 2 main functions that I want
Using the publish_post hook, I want access to the email address of the user
I want to access the call stack at runtime in a Native C++ application.
I want access to a picture using image.setImageResource(R.drawable.photo1); How can I change photo1 to
I have created sqlite database using phonegap. I am able to access that databse
I want to access DataAnnotation 's GroupName in MVC view. For example, let's say
I want to access music files which are available on the iPhone and get
I am new in C but not in programming. I want access keyboard keys
Creating a 32 bit application with delphi I do not have access to all
I want access to symfony's libraries of my project into some other php files.

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.