Use of MSXML (MSXML3, MSXML4, MSXML6 our COM component libraries) in .NET applications are not supported

Our KB article clearly states this. Then, you may ask me “Why this guy is repeating the documented thing in this blog post ?”. Answer is simple, we do see lots of issues coming from our customers about this and I want to mention about this point in this blog too just thinking that I may prevent our developer community before designing their .NET apps with MSXML. Because we do see that some new .NET developers who are used to use MSXML before .NET wants to use those MSXML libraries.

Also you can ask us “if it is not supported why don’t you prohibit MSXML usage in .NET with someway?” . The short answer is “we cannot”. The long answer is liket that… Our MSXML (3,4,6) COM libraries are our COM libraries for you to use it in your non-.NET applications. Using COM libraries in a .NET app (we do call this as “doing COM Interop”) is not prohibited, but you should be careful which COM component you’re doing interop. You can write your own COM component and use/call it in your .NET app and it could work without issues. But as I said, it depends what does it do, especailly by means of “thread-safety”. MSXML uses threading models and garbage-collection mechanisms that are not compatible with the .NET Framework. Using MSXML in .NET applications through COM interoperability can result in unexpected problems that are difficult to debug.

So what should you do ? Simple. Use our System.Xml namespace there waiting for you to use in your .NET applications.

The similar situation applies for ADO Interop. Please refer to . You’ll see that we do not say it’s not supported at all but there are lots of limitations.

Again, I want to remind that we have ADO.NET for you to use in your .NET applications.

Please do notice that your brand new fuel/electric hybrid car already has got a nice stereo with MP3/WMA XM Radio etc. playing capability and do not try to assemble your old old casette tape player to your brand new car 😉

Comments (2)

  1. p says:

    Could you elaborate a bit on what sort of "threading models and garbage-collection mechanisms" make COM components incompatible with .NET? I'm currently developing an application that consists of a several COM componenents, one if which is  a .NET library exposed through COM interop, so I would like to avoid unintentionally usings such models and mechanisms.

  2. Faruk Celik says:

    The things you ask is the inner workings /design of MSXML and I don't know how its designed in detail. You may refer to MSDN "Interoperability Overview (C# Programming Guide)" :…/ms173185.aspx

    "Chapter 7 — Improving Interop Performance" in…/ms998551.aspx also still a perfect document though it is from year 2004.

    You may also want to check "Advanced COM Interoperability" in…/bd9cdfyx(v=vs.90).aspx