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

The Archive Base Latest Questions

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

I want to display my application version number within my application, and the simplest

  • 0

I want to display my application version number within my application, and the simplest way to do this is to use the version number for the assembly.

var assembly = System.Reflection.Assembly.GetExecutingAssembly();
var name = assembly.GetName();
return String.Format("Version {0}.{1}", name.Version.Major, name.Version.Minor);

I can get the executing assembling without problem, but the call to GetName() returns a MethodAccessException with this message

Attempt by security transparent method ‘MainPage..ctor()’ to access security critical method ‘System.Reflection.Assembly.GetName()’ failed.

Why is this happening, is there anything I can do about it, and if not is there another means of retrieving the assembly version?

  • 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-26T11:30:25+00:00Added an answer on May 26, 2026 at 11:30 am

    The Assembly.GetName is marked with SecurityCriticalAttribute attribute try using GetCallingAssembly().FullName and scrape the version info out of it.

    Do not use this member in your application. If you do, your code will
    throw a MethodAccessException. This member is security-critical, which
    restricts it to internal use by the .NET Framework for Silverlight
    class library. [SECURITY CRITICAL]

    from: http://msdn.microsoft.com/en-us/library/9w2wdeze(VS.95).aspx

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

Sidebar

Related Questions

Within a Silverlight 3.0 application I want to use the AssemblyFileVersion to display the
I want to be able to display the current version of a .NET application
I have a simple quiz application and I want display a nice timer /
I want to display an image at 'true size' in my application. For that
I want to display an HTML formatted content in my application preferably inside a
I want to display the time (including seconds) in an application in a text
I want to display the favicon.ico from websites on my blackberry application. I would
I want to display a popup windo on my rails application... Here is exactly
I am writing an application for Windows Mobile where I want to display some
I am working on a windows application where i want to display orkut user

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.