Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. FXCOP CLSCompliant

FXCOP CLSCompliant

Scheduled Pinned Locked Moved .NET (Core and Framework)
question
11 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • realJSOPR Offline
    realJSOPR Offline
    realJSOP
    wrote on last edited by
    #1

    How can I be sure that an assembly is CLS-compliant?

    "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
    -----
    "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

    L J 2 Replies Last reply
    0
    • realJSOPR realJSOP

      How can I be sure that an assembly is CLS-compliant?

      "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
      -----
      "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

      L Offline
      L Offline
      Lev Danielyan
      wrote on last edited by
      #2

      Do you mean, apart from checking if it's got the CLSCompliant(true) attribute?

      Regards, Lev

      realJSOPR 1 Reply Last reply
      0
      • L Lev Danielyan

        Do you mean, apart from checking if it's got the CLSCompliant(true) attribute?

        Regards, Lev

        realJSOPR Offline
        realJSOPR Offline
        realJSOP
        wrote on last edited by
        #3

        Yes. FXCOP says I should use the attribute if the assembly is CLSCompliant, but how do I know if it is?

        "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
        -----
        "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

        L 2 Replies Last reply
        0
        • realJSOPR realJSOP

          Yes. FXCOP says I should use the attribute if the assembly is CLSCompliant, but how do I know if it is?

          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
          -----
          "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

          L Offline
          L Offline
          Lev Danielyan
          wrote on last edited by
          #4

          I think you have two options: 1. Add the [assembly:CLSCompliant(true)] attribute to the assembly, and see what are the compiler's errors/warnings 2. Or if you need to do it in code, look at the CLS compliance restrictions in the ECMA 335 standard[^] (it's got a lot of info on CLS compliance) and check for these using Microsoft.Cci (the fxcop's backend) or Mono.Cecil

          Regards, Lev

          realJSOPR 1 Reply Last reply
          0
          • realJSOPR realJSOP

            How can I be sure that an assembly is CLS-compliant?

            "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
            -----
            "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

            J Offline
            J Offline
            Joe DiNatale
            wrote on last edited by
            #5

            My understanding is that you should mark the attribute if you intend it to be CLS compliant and then compiler will let you know if it isn't. Look here for more info. -Joe.

            L 1 Reply Last reply
            0
            • J Joe DiNatale

              My understanding is that you should mark the attribute if you intend it to be CLS compliant and then compiler will let you know if it isn't. Look here for more info. -Joe.

              L Offline
              L Offline
              Lev Danielyan
              wrote on last edited by
              #6

              That's what I said in my previous post. But I think it is more challenging to analyze the assembly and figure out if it is CLS compliant.

              Regards, Lev

              realJSOPR 1 Reply Last reply
              0
              • L Lev Danielyan

                I think you have two options: 1. Add the [assembly:CLSCompliant(true)] attribute to the assembly, and see what are the compiler's errors/warnings 2. Or if you need to do it in code, look at the CLS compliance restrictions in the ECMA 335 standard[^] (it's got a lot of info on CLS compliance) and check for these using Microsoft.Cci (the fxcop's backend) or Mono.Cecil

                Regards, Lev

                realJSOPR Offline
                realJSOPR Offline
                realJSOP
                wrote on last edited by
                #7

                Lev Danielyan wrote:

                Add the [assembly:CLSCompliant(true)] attribute to the assembly, and see what are the compiler's errors/warnings

                Yep, I did that and didn't get any errors or warnings.

                "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                -----
                "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                L 1 Reply Last reply
                0
                • realJSOPR realJSOP

                  Lev Danielyan wrote:

                  Add the [assembly:CLSCompliant(true)] attribute to the assembly, and see what are the compiler's errors/warnings

                  Yep, I did that and didn't get any errors or warnings.

                  "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                  -----
                  "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                  L Offline
                  L Offline
                  Lev Danielyan
                  wrote on last edited by
                  #8

                  Then you are safe to mark it with CLSCompliant attribute :)

                  Regards, Lev

                  1 Reply Last reply
                  0
                  • L Lev Danielyan

                    That's what I said in my previous post. But I think it is more challenging to analyze the assembly and figure out if it is CLS compliant.

                    Regards, Lev

                    realJSOPR Offline
                    realJSOPR Offline
                    realJSOP
                    wrote on last edited by
                    #9

                    "More challenging" = "more time-consuming".

                    "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                    -----
                    "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                    L 1 Reply Last reply
                    0
                    • realJSOPR realJSOP

                      "More challenging" = "more time-consuming".

                      "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                      -----
                      "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                      L Offline
                      L Offline
                      Lev Danielyan
                      wrote on last edited by
                      #10

                      Right, but it will give more knowledge on the guts of .Net, and eventually you will be writing compliant code right away (of course in those cases when you actually can make your assembly compliant), it can make some time savings as opposed to marking your stuff with attribute and fixing errors (especially for large products). But this is just IMHO ;)

                      Regards, Lev

                      1 Reply Last reply
                      0
                      • realJSOPR realJSOP

                        Yes. FXCOP says I should use the attribute if the assembly is CLSCompliant, but how do I know if it is?

                        "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                        -----
                        "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                        L Offline
                        L Offline
                        Lev Danielyan
                        wrote on last edited by
                        #11

                        BTW, check out this article[^]

                        Regards, Lev

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups