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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:41:37+00:00 2026-05-13T07:41:37+00:00

A while ago, I wrote some Word interop examples in Visual Studio beta 1,

  • 0

A while ago, I wrote some Word interop examples in Visual Studio beta 1, and set the reference to Microsoft.Office.Interop.Word to be embedded (set the “Embed Interop Types” = true in the reference properties). These worked fine, and I haven’t run them for a while… until today.

Of course, now I’m running under beta 2 of both Visual Studio 2010 and .NET 4.0 – and it seems to be somewhat broken.

Here’s the code in question (just dummy example code):

using Microsoft.Office.Interop.Word;

class WordImprovement1
{
    static void Main()
    {
        Application app = new Application { Visible = true };
        app.Documents.Add();
        Document doc = app.ActiveDocument;            
        Paragraph para = doc.Paragraphs.Add();
        para.Range.Text = "Thank goodness for C# 4";

        object filename = "demo.doc";
        object format = WdSaveFormat.wdFormatDocument97;
        doc.SaveAs(FileName: ref filename, FileFormat: ref format);
        doc.Close();
        app.Quit();
    }
}

Here’s the exception I get most of the time, when “Embed Interop Types” is set to “true” or I link with “/l” on the command line:

System.MissingMethodException: Method not found:
'Void Microsoft.Office.Interop.Word._Application.set_Visible(Boolean)'.
   at WordImprovement1.Main()

Very occasionally, it works – which is even more bizarre.

If I set “Embed Interop Types” to “false” (or use /r on the command line instead of /l) it all works fine.

If I remove the “Visible = true” property setter it works too… but I know that property’s there… it’s even suggested by IntelliSense!

While I haven’t done exhaustive testing on multiple boxes, I can confirm that my netbook (running Windows 7 instead of Vista, but still .NET 4.0 beta 2) sees the same problem.

Any suggestions as to whether it’s me that’s broken or .NET 4.0 beta 2?

  • 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-13T07:41:37+00:00Added an answer on May 13, 2026 at 7:41 am

    Great catch! This looks like a bug in our code generation for indexed properties (not a known one, so thanks for reporting this!) I’ve tried on the latest internal build of VS 2010 and it reproduces as well.

    What happens is that if you use an object initializer, then the following code is generated:

    Application <>g__initLocal19 = (Application) Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("000209FF-0000-0000-C000-000000000046")));
    <>g__initLocal19.set_Visible(true);
    

    However if you set Visible = true in a separate statement (without the object initializer), then the following code is emitted:

    Application application = (Application) Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("000209FF-0000-0000-C000-000000000046")));
    application.Visible = true;
    

    The PIA only defines the bottom one, hence it fails when you’re using an object initializer. The workaround for now is to set Visible in a separate statement which should work fine.

    I’ve logged a bug about this. Thanks again!

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

Sidebar

Ask A Question

Stats

  • Questions 367k
  • Answers 367k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer What's the view source on your page look like? I… May 14, 2026 at 4:47 pm
  • Editorial Team
    Editorial Team added an answer print(__FUNCTION__) // Swift NSLog(@"%@", NSStringFromSelector(_cmd)); // Objective-C Swift 3 and… May 14, 2026 at 4:47 pm
  • Editorial Team
    Editorial Team added an answer Jythonc was removed in Jython 2.2 and is no longer… May 14, 2026 at 4:47 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.