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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. The Lounge
  3. Some things will always suck in .Net, I guess

Some things will always suck in .Net, I guess

Scheduled Pinned Locked Moved The Lounge
csharplinqjsonfunctionalhelp
30 Posts 17 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.
  • D damir_tk

    I am sure this was supposed to be funny...just don't get if it's only Bangalore funny or worldwide funny.

    C Offline
    C Offline
    Colin Angus Mackay
    wrote on last edited by
    #18

    I think it is funny and I'm from Scotland.

    Recent blog posts: *SQL Server / Visual Studio install order *Installing SQL Server 2005 on Vista *Tip of the Day - SysInternals * Meme My Blog

    D 1 Reply Last reply
    0
    • D damir_tk

      I agree with you to the most part. But tell me - why do we have all new emerging technologies and fancy stuff, when even this what we have is not working properly? If serialization is for small object, then why the whole Workflows in WF are getting serialized, and with their state as well? I had to write an extensive plugin architecture a year ago, now I resolved all the issues this way or another, but the painful parts: Why shadow folders are not working? If it was spotted in framework version 1.0, why it hasn't been fixed by now? Why can't I load an assembly from anywhere on the disk, if we are beyond "dll hell", but only below the current executing folder? If I serialize an object, why can't I use it later on if I change the version of my assembly? I have to go custom serialization each and every time, and many of my classes are HUGE! Why is it possible to load multiple instances of the same dll any number of times into the app domain? Why does an assembly gets locked the moment I touch it? Why can't it ever be unloaded from that or any other app domain? Why I can only serialize objects of classes that only have public constructors, and no other flavors? How to use serialization when it will break the moment I change the name of my class, or use strong name for the assembly? Why should I use a process that is relying internally on CodeDom, and will turn the execution order of my constructors upside down after deserialization? Create an assembly and try to load some plugins for it. Designate a folder for plugins, those plugin assemblies have some references, compile it, everything works. Check it to TFS, get somebody else on your team to pull the latest version and to compile it on his computer, drop those assemblies into the very same folder, and it will throw an exception. Why is that? Everybody says something underlying buried deep down in .Net framework. How to solve it? Why the code compiles at all even on my machine? Apparently, you have to add an empty event for AppDomain.CurrentDomain.AssemblyResolve, and nobody knows why this resolves the problem, when it does nothing in it just exists as an event. Somebody may even like this mystery and net framework being so full of surprises (this is why people use Linux in the first place, cause they like to suffer and have time for that), but I need an environment that is working and that I can rely on 100%, at least in the major features. Otherwise I get in the situation where production goes crazy and is stating how much

      M Offline
      M Offline
      Marc Clifton
      wrote on last edited by
      #19

      (note, things I haven't addressed are things I don't know much about)

      damir_tk wrote:

      I agree with you to the most part. But tell me - why do we have all new emerging technologies and fancy stuff, when even this what we have is not working properly?

      Ah, well, that's a good question, and frankly that's the reason I haven't touched WF or Entity Framework. Lack of trust, because I agree with you--a lot of what's coming out of MS is half-baked, even after the RTM.

      damir_tk wrote:

      If serialization is for small object, then why the whole Workflows in WF are getting serialized, and with their state as well?

      Because other programmers at MS use the tools/technologies available, without much thought? I see this even in non-MS devs: they reach for the "simple" solution because it's there, without thinking.

      damir_tk wrote:

      Why can't I load an assembly from anywhere on the disk, if we are beyond "dll hell", but only below the current executing folder?

      You can. You have to provide the fully qualified path. And there's a nifty event that fires that lets you resolve an assembly when .NET can't. I use it a lot. Very useful.

      damir_tk wrote:

      If I serialize an object, why can't I use it later on if I change the version of my assembly?

      How are you serializing? If I serialize a class to XML, it works fine. Otherwise, I think it's a good thing, sort of, because the serializer doesn't know what has changed in your assembly, it only knows that something HAS changed. I guess it's a safeguard.

      damir_tk wrote:

      and many of my classes are HUGE!

      Erm...that's an indication you are not controlling the serialization correctly. Sounds like you're relying on the automation too much.

      damir_tk wrote:

      Why is it possible to load multiple instances of the same dll any number of times into the app domain?

      IIRC, you can't. Once it's loaded in memory, you can load it again, but it knows and doesn't reload it. Are your experiences different?

      damir_tk wrote:

      Why can't it ever be unloaded from that or any other app domain?

      Wait a minute. I thought one of the tricks of an app domain is that it's the only way t

      D B 2 Replies Last reply
      0
      • M Marc Clifton

        Well, not to defend MS, but think about a few things. Serialization is an amazing thing to begin with. Prior to .NET, serialization was all custom coding to begin with! Serialization needs a lot of help. It cannot read your mind. Translating a class to a generic format needs your help, which is why we have these attributes, to give .NET some clue as to what we want serialized and how. Be happy that MS provided you with the ability to completely control the serialization process! Yes, the BinaryFormatter sucks for any heavy duty lifting. [plug] Which is why I wrote some articles on more compact serialization. [/plug] On the other hand, keep in mind that the serialization in .NET works very well for small packets of data and ties in well with web services, SOAP, etc. It's a general purpose technology that fits a particular niche, and beyond that, you can easily customize it to your requirements. Sometimes it really is awesome that I can serialize a DataTable without thinking about it, and other times, I feed it through my serializer because I know the BinaryFormatter won't handle it, and isn't a real stream anyways. So, pick the right tool for the job. OMG. What have I said!?!?! :rolleyes: Marc

        Thyme In The Country Interacx My Blog

        E Offline
        E Offline
        Ennis Ray Lynch Jr
        wrote on last edited by
        #20

        I just gave up on it and now I write custom serialization for all of my serializable objects. I stopped having problems! Sure it takes some extra time but less than I have spend on average dealing with the issues left by MS. Personally, I think if they would have made private fields serializable by default without custom serialization most users serialization issues would have gone away. Even after reading the MS justification I am tired of the everything should be public methodology, although now in .NET I almost exclusively write public methods and classes just so the framework will support the code I want to write. Personally, I find it laughable that some framework classes and methods are actually documented, "Internal for .NET framework do not use". Which of course is so much better than using internal and private anything.

        Need a C# Consultant? I'm available.
        Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

        1 Reply Last reply
        0
        • M Marc Clifton

          (note, things I haven't addressed are things I don't know much about)

          damir_tk wrote:

          I agree with you to the most part. But tell me - why do we have all new emerging technologies and fancy stuff, when even this what we have is not working properly?

          Ah, well, that's a good question, and frankly that's the reason I haven't touched WF or Entity Framework. Lack of trust, because I agree with you--a lot of what's coming out of MS is half-baked, even after the RTM.

          damir_tk wrote:

          If serialization is for small object, then why the whole Workflows in WF are getting serialized, and with their state as well?

          Because other programmers at MS use the tools/technologies available, without much thought? I see this even in non-MS devs: they reach for the "simple" solution because it's there, without thinking.

          damir_tk wrote:

          Why can't I load an assembly from anywhere on the disk, if we are beyond "dll hell", but only below the current executing folder?

          You can. You have to provide the fully qualified path. And there's a nifty event that fires that lets you resolve an assembly when .NET can't. I use it a lot. Very useful.

          damir_tk wrote:

          If I serialize an object, why can't I use it later on if I change the version of my assembly?

          How are you serializing? If I serialize a class to XML, it works fine. Otherwise, I think it's a good thing, sort of, because the serializer doesn't know what has changed in your assembly, it only knows that something HAS changed. I guess it's a safeguard.

          damir_tk wrote:

          and many of my classes are HUGE!

          Erm...that's an indication you are not controlling the serialization correctly. Sounds like you're relying on the automation too much.

          damir_tk wrote:

          Why is it possible to load multiple instances of the same dll any number of times into the app domain?

          IIRC, you can't. Once it's loaded in memory, you can load it again, but it knows and doesn't reload it. Are your experiences different?

          damir_tk wrote:

          Why can't it ever be unloaded from that or any other app domain?

          Wait a minute. I thought one of the tricks of an app domain is that it's the only way t

          D Offline
          D Offline
          damir_tk
          wrote on last edited by
          #21

          Thank you, you are very knowledgeable, I appreciate you discuss these with me in general. Just some of my thoughts on the above:

          Marc Clifton wrote:

          Ah, well, that's a good question, and frankly that's the reason I haven't touched WF or Entity Framework. Lack of trust, because I agree with you--a lot of what's coming out of MS is half-baked, even after the RTM.

          Agree.

          Marc Clifton wrote:

          Because other programmers at MS use the tools/technologies available, without much thought? I see this even in non-MS devs: they reach for the "simple" solution because it's there, without thinking.

          Agree.

          Marc Clifton wrote:

          You can. You have to provide the fully qualified path. And there's a nifty event that fires that lets you resolve an assembly when .NET can't. I use it a lot. Very useful.

          Not everything is that simple really. Try this: You have your project in c:\Projects\TestForMarc, and you have other assemblies that you want to load in c:\SomeAsms. Now you do LoadFrom("c:\ComeAsms\SomeAsm.dll");, meaning that asm is in the LoadFrom context. Now you are back in your AppDomain doing stuff, you serialize that asm and deserialize it there. Now, deserialization will call Load("ASM, [...]"), or something like this, where path is not presented, and what will happen is that if ASM is not in the LoadContext then you get an exception, even though you have it loaded in your AppDomain! List out the loaded assemblies, and it is there! Now it gets even worse - you rely on all mighty AssemblyResolve to save the day, but that will automatically load any that assembly that exists in the GAC or below the AppBase - and will do that automatically. After that, you will end up with two same assemblies in your current AppDomain, none of which you will be able to cast the types from.

          Marc Clifton wrote:

          Erm...that's an indication you are not controlling the serialization correctly. Sounds like you're relying on the automation too much.

          There are many classes and we put a lot of focus on implementing a correct design pattern to make a proper solution for every single architectural problem or enhancement. Now saying that, we use every possible way to declare, seal, inherit, override or whatever it takes to implement a correct solution for a specific problem - now throw in some need for serial

          M 1 Reply Last reply
          0
          • C Colin Angus Mackay

            I think it is funny and I'm from Scotland.

            Recent blog posts: *SQL Server / Visual Studio install order *Installing SQL Server 2005 on Vista *Tip of the Day - SysInternals * Meme My Blog

            D Offline
            D Offline
            damir_tk
            wrote on last edited by
            #22

            Well I guess no need to discuss different people and different customs, but also maybe you need to be mature enough to regard something ridiculous as that remark was. But this is not about that anyhow, but about you and somebody who dares to touch your God. So please, do not let me disturb you in your worshiping. End of discussion. Damir

            C 1 Reply Last reply
            0
            • D damir_tk

              I am not even going to reply to this or the next 2 posts under that one up there, as you are obviously not on top of this.

              S Offline
              S Offline
              Shog9 0
              wrote on last edited by
              #23

              damir_tk wrote:

              you are obviously not on top of this

              Heh. You chose a library to do your work for you, don't like how it works, and chose to whine about it. What's left to understand?

              Citizen 20.1.01

              'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'

              1 Reply Last reply
              0
              • D Dirk Higbee

                Paul Conrad wrote:

                Talk about being lazy.

                Looks like another peas halp do it for me, eh?

                Beauty is only a light switch away.

                P Offline
                P Offline
                Paul Conrad
                wrote on last edited by
                #24

                Possibly so.

                "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

                1 Reply Last reply
                0
                • M Marc Clifton

                  (note, things I haven't addressed are things I don't know much about)

                  damir_tk wrote:

                  I agree with you to the most part. But tell me - why do we have all new emerging technologies and fancy stuff, when even this what we have is not working properly?

                  Ah, well, that's a good question, and frankly that's the reason I haven't touched WF or Entity Framework. Lack of trust, because I agree with you--a lot of what's coming out of MS is half-baked, even after the RTM.

                  damir_tk wrote:

                  If serialization is for small object, then why the whole Workflows in WF are getting serialized, and with their state as well?

                  Because other programmers at MS use the tools/technologies available, without much thought? I see this even in non-MS devs: they reach for the "simple" solution because it's there, without thinking.

                  damir_tk wrote:

                  Why can't I load an assembly from anywhere on the disk, if we are beyond "dll hell", but only below the current executing folder?

                  You can. You have to provide the fully qualified path. And there's a nifty event that fires that lets you resolve an assembly when .NET can't. I use it a lot. Very useful.

                  damir_tk wrote:

                  If I serialize an object, why can't I use it later on if I change the version of my assembly?

                  How are you serializing? If I serialize a class to XML, it works fine. Otherwise, I think it's a good thing, sort of, because the serializer doesn't know what has changed in your assembly, it only knows that something HAS changed. I guess it's a safeguard.

                  damir_tk wrote:

                  and many of my classes are HUGE!

                  Erm...that's an indication you are not controlling the serialization correctly. Sounds like you're relying on the automation too much.

                  damir_tk wrote:

                  Why is it possible to load multiple instances of the same dll any number of times into the app domain?

                  IIRC, you can't. Once it's loaded in memory, you can load it again, but it knows and doesn't reload it. Are your experiences different?

                  damir_tk wrote:

                  Why can't it ever be unloaded from that or any other app domain?

                  Wait a minute. I thought one of the tricks of an app domain is that it's the only way t

                  B Offline
                  B Offline
                  BillWoodruff
                  wrote on last edited by
                  #25

                  Some of us suckers are praying for the "Clifton genius" to manifest itself in the form of the "ultimate" monograph (or book) on serialization ! Not that we are unhappy now, however, as we suck up what there is to be sucked : nay, we are grateful, even if our own ignorance prevents us from fully sucking all that could be sucked from what is in our suckers :) best, Bill

                  "The greater the social and cultural distances between people, the more magical the light that can spring from their contact." Milan Kundera in Testaments Trahis

                  1 Reply Last reply
                  0
                  • D damir_tk

                    Well I guess no need to discuss different people and different customs, but also maybe you need to be mature enough to regard something ridiculous as that remark was. But this is not about that anyhow, but about you and somebody who dares to touch your God. So please, do not let me disturb you in your worshiping. End of discussion. Damir

                    C Offline
                    C Offline
                    Colin Angus Mackay
                    wrote on last edited by
                    #26

                    :confused:

                    Recent blog posts: *SQL Server / Visual Studio install order *Installing SQL Server 2005 on Vista *Tip of the Day - SysInternals * Meme My Blog

                    1 Reply Last reply
                    0
                    • D damir_tk

                      Thank you, you are very knowledgeable, I appreciate you discuss these with me in general. Just some of my thoughts on the above:

                      Marc Clifton wrote:

                      Ah, well, that's a good question, and frankly that's the reason I haven't touched WF or Entity Framework. Lack of trust, because I agree with you--a lot of what's coming out of MS is half-baked, even after the RTM.

                      Agree.

                      Marc Clifton wrote:

                      Because other programmers at MS use the tools/technologies available, without much thought? I see this even in non-MS devs: they reach for the "simple" solution because it's there, without thinking.

                      Agree.

                      Marc Clifton wrote:

                      You can. You have to provide the fully qualified path. And there's a nifty event that fires that lets you resolve an assembly when .NET can't. I use it a lot. Very useful.

                      Not everything is that simple really. Try this: You have your project in c:\Projects\TestForMarc, and you have other assemblies that you want to load in c:\SomeAsms. Now you do LoadFrom("c:\ComeAsms\SomeAsm.dll");, meaning that asm is in the LoadFrom context. Now you are back in your AppDomain doing stuff, you serialize that asm and deserialize it there. Now, deserialization will call Load("ASM, [...]"), or something like this, where path is not presented, and what will happen is that if ASM is not in the LoadContext then you get an exception, even though you have it loaded in your AppDomain! List out the loaded assemblies, and it is there! Now it gets even worse - you rely on all mighty AssemblyResolve to save the day, but that will automatically load any that assembly that exists in the GAC or below the AppBase - and will do that automatically. After that, you will end up with two same assemblies in your current AppDomain, none of which you will be able to cast the types from.

                      Marc Clifton wrote:

                      Erm...that's an indication you are not controlling the serialization correctly. Sounds like you're relying on the automation too much.

                      There are many classes and we put a lot of focus on implementing a correct design pattern to make a proper solution for every single architectural problem or enhancement. Now saying that, we use every possible way to declare, seal, inherit, override or whatever it takes to implement a correct solution for a specific problem - now throw in some need for serial

                      M Offline
                      M Offline
                      Marc Clifton
                      wrote on last edited by
                      #27

                      damir_tk wrote:

                      I simply want to know why serialization has so many issues, why it is so limited, why so many issues on the assembly level, why remoting is so slow and should I go back to C++ binary tcp communication while this technology gets matured, and stuff like that.

                      Well! Thanks for the reply. Sounds like you're doing some really neat stuff and I can see how the .NET framework is getting in the way with its issues. You remind me of something I realized a while ago--the people who are writing the framework appear to be thinking only in terms of a very limited problem domain. Step outside of MS's idea of how to use various components, and you run into problems. I agree, it is frustrating, especially since they don't go back and clean up their house, but keep adding facades to hide the mess. And thank you for helping me understand the issues better! Marc

                      Thyme In The Country Interacx My Blog

                      1 Reply Last reply
                      0
                      • P PIEBALDconsult

                        I second everything Marc said. Plus I never use the built-in serialization for my classes; I always write custom serialization. There is no substitute for the right way.

                        A Offline
                        A Offline
                        Alan Balkany
                        wrote on last edited by
                        #28

                        I've been using XML serialization, and the SOAP format seems very verbose, cryptic, and wasteful. I can accept that, but then I constantly ran into problems. For one I found a cryptic fix on the web that worked, but it makes me uneasy that I don't understand how or why it worked. Custom serialization will definitely be more work, but it will be worth it for the reliability and sanity.

                        1 Reply Last reply
                        0
                        • J Joan M

                          Between 1 and 3? Anyway, seconded!

                          [www.tamelectromecanica.com][www.tam.cat]

                          H Offline
                          H Offline
                          Hamed Musavi
                          wrote on last edited by
                          #29

                          Joan Murt wrote:

                          Between 1 and 3

                          Did you mean 01 and 11? :-D

                          "In the end it's a little boy expressing himself."    Yanni

                          J 1 Reply Last reply
                          0
                          • H Hamed Musavi

                            Joan Murt wrote:

                            Between 1 and 3

                            Did you mean 01 and 11? :-D

                            "In the end it's a little boy expressing himself."    Yanni

                            J Offline
                            J Offline
                            Joan M
                            wrote on last edited by
                            #30

                            Yess! :-D

                            [www.tamelectromecanica.com][www.tam.cat]

                            https://www.robotecnik.com freelance robots, PLC and CNC programmer.

                            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