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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:25:14+00:00 2026-05-24T20:25:14+00:00

We write some winForms GUI application that uses the Invariant Culture. So in the

  • 0

We write some winForms GUI application that uses the Invariant Culture. So in the beginning of the Main we have:

    [STAThread]
    static void Main()
    {
        CultureInfo culture = CultureInfo.InvariantCulture;
        System.Threading.Thread.CurrentThread.CurrentCulture = culture;
        ... 

The problem is that on some machines it works perfectly but on some machines on some configurations ( like Debug/AnyCPU fro x64 machines) it raises SequrityException

Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

So what is the problem with it? And why it happens only on some conditions?

  • 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-24T20:25:14+00:00Added an answer on May 24, 2026 at 8:25 pm

    Another post mentions security issues when using the invariant culture. Perhaps this is your issue?

    Using the InvariantCulture Property

    The InvariantCulture property represents neither a neutral nor a
    

    specific culture. It represents a third type of culture that is
    culture-insensitive. It is associated with the English language but
    not with a country or region. Your applications can use this property
    with almost any method in the System.Globalization namespace that
    requires a culture. However, an application should use the invariant
    culture only for processes that require culture-independent results,
    such as formatting and parsing data that is persisted to a file. In
    other cases, it produces results that might be linguistically
    incorrect or culturally inappropriate.

    Security Considerations If a security decision will be made based
    

    on the result of a string comparison or case change, your application
    should use an ordinal comparison that ignores case instead of using
    InvariantCulture. The default implementations of methods such as
    Compare()()() and ToUpper use the CurrentCulture property. Code that
    performs culture-sensitive string operations can cause security
    vulnerabilities if CurrentCulture is changed or if the culture on the
    computer running the code differs from the culture used to test the
    code. The behavior that you expect when writing a string operation
    differs from the actual behavior of your code on the executing
    computer. In contrast, an ordinal comparison depends solely on the
    binary value of the compared characters.

    String Operations If your application needs to perform a
    

    culture-sensitive string operation that is not affected by the value
    of CurrentCulture, it should use a method that accepts a CultureInfo
    parameter. The application should specify the value of the
    InvariantCulture property for this parameter. The application should
    use the property with methods such as Compare()()() and ToUpper to
    eliminate cultural variations and ensure consistent results. For more
    information about using the InvariantCulture property to perform
    culture-insensitive string operations, see Culture-Insensitive String
    Operations.

    Persisting Data The InvariantCulture property is useful for
    

    storing data that will not be displayed directly to users. Storing
    data in a culture-independent format guarantees a known format that
    does not change. When users from different cultures access the data,
    it can be formatted appropriately based on specific user. For example,
    if your application stores DateTime types in a text file, formatted
    for the invariant culture, the application should use the
    InvariantCulture property when calling ToString to store the strings
    and the Parse method to retrieve the strings. This technique ensures
    that the underlying values of the DateTime types do not change when
    the data is read or written by users from different cultures.

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

Sidebar

Related Questions

I'm planning on writing a medium-size WinForms application that I'll write in C#, .NET
In some winforms / webforms applications, I wrote a module that at application start,
I have written a wrapper application in .Net that starts another WinForms application with
i write some utility class but how to get name ? Can that send
I want to write some JavaScript that will change the onmousedown of a div
I would like to write some scripts in python that do some automated changes
I'd like to write some (java) code that takes a PDF document, and creates
I'm trying to write some LINQ To SQL code that would generate SQL like
I'd like to write some unit tests for some code that connects to a
I'd like to write some basic tests for our web and Winforms applications. I

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.