none
Why does WPF app load System.Web, System.Data.OracleClient, System.EnterpriseServices RRS feed

  • Question

  • I'm building a WPF .NET 4.5 app with EF 5. It loads these 3 assemblies though they are not used in the application level. System.Web, System.Data.OracleClient, System.EnterpriseServices

    Is there someway to configure .NET to avoid loading them?

    Thanks!

    Sunday, August 4, 2013 3:28 PM

Answers

  • Hi Scottz1,

    Thanks for your clarification. I am now working with Hetro to help you solve the problem.

    For your question:

    Q: “Do you think there are any scenarios where System.Web, System.Data.OracleClient, System.EnterpriseServices are loaded dynamically?”

    A: Per my experience, there are 3 possible scenarios:

    1. There are some third-party staff hook on VS and will load some assemblies.
    2. VS project templates is not the default one.
    3. There is an assembly in your project has these dependencies, and you modified it before to avoid loading these assemblies. But you application still reference to the old version. When you copy the project to another PC, it cannot find the old one and got the new version loaded. It’s really hard to say what it is, but need to check your project.

    To better understand this problem, please help me confirm if you have done the following tests in case we missed something. If not, please try them and let me know the result. I understand perform these tests may spend lot of time, but I believe it will help us find the issue. Thanks for your cooperation.

    1. On the problematic PC, check if the project has same dlls loaded when start debugging in both VS 2010 Professional, and VS 2010 Express.  If you can provide a copy of the output here, it will be more helpful.

    2. Close all Visual Studio, Open VS command prompt and type the following command, which will be helpful to check if there is any problem during VS starting. Please share the log to me via Skydrive.

     devenv /log c:\vsloadmoreassembly.log

    3. Create a new WPF project on your problematic PC, and check if the debug output still show additional assemblies. This will help us to check if it is related to VS project templates.

    4. Open all project files, sub project files and config files in notepad to see if you can find the interest assemblies.

    Scottz1, if we can determine this issue is only related to your current project and it will not happen on other machines, I think it will not impact much on your business. However, if you do need to find out what is the root cause of this problem. I have 2 suggestions:

    1. Try to think about what you have changed and what you have configured on your projects by yourself, and remove the problematic staff. Actually, reinstall may be a quicker solution.
    2. Contact our phone support team at http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone. Which enables our engineer connect to your PC to help you find the problem.

    Look forward to hearing from you.

    Thanks,


    Alan Yao [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.




    Thursday, August 8, 2013 7:14 AM
  • The Reflector tool just tells me that System.Data.dll or System.Transactions.dll references System.EnterpriseServices.dll, and in System.Data.dll, one internal method may load System.Data.OracleClient.dll dynamically. (just use reflector tool to reflect the code of .Net, not an official source code)

    So for checking your issue, I suggest to remove some independent code, and share the code with us, we may help you to verify the reference map of the code.


    Bob Bao

    Do you still use the same Windows 8 LockScreen always? Download Chameleon Win8 App quickly, that changes your LockScreen constantly.
    你是否还在看着一成不变的Windows 8锁屏而烦恼,赶紧下载这个 百变锁屏 应用,让你的锁屏不断地变化起来。


    Monday, August 12, 2013 3:26 AM

All replies

  • Hi Scottz1,

    Thank you for posting in our CLR forum, I will be working with you on this post.

    From your description, I notice the issue you are experiencing is visual studio loads some assemblies what you do not need.

    I can`t reproduce this issue, my visual studio 2012 works fine. I`d like to suggest you rebuild VS templates. Close all instance of Visual Studio. Open visual studio command prompt and type “devenv /installvstemplates”, Press Enter. Let the process be complete.

    If you are running Vista or later, you should run the command prompt via Right Click -> Run as Administrator, as this command requires you to run in an elevated mode.

    I hope this can help you.

    Best Regards.

    Tuesday, August 6, 2013 1:01 AM
    Moderator
  • Hi Hetro,

    Thank you very much for your ideas. I closed VS, ran "devenv /installvstemplates" from elevated prompt. It gave no ouput but finished in about a minute. I restarted VS, cleaned the solution, rebuild all, run. I see in the debug output window that it still loads System.Web, System.Data.OracleClient, System.EnterpriseServices (as well as System.EnterpriseServices.Wrapper.dll).

    Next I downloaded and installed "checkasm" from Amberfish.net. I exported the full tree of dependencies and searched the output file for web, oracle, and enterprise and it finds none of those strings. So it seems .NET or another assembly I'm using is loading those dynamically.

    Is it possible that EF dynamically loads OracleClient?

    EF depends on System.Transactions, perhaps System.Transactions dynamically loads EnterpriseServices?

    Perhaps System.Runtime.Serialization dynamically loads Web?

    Thanks!

    Tuesday, August 6, 2013 2:00 AM
  • Hi Scottz1,

    Based on my analysis of the issue, we should work together to confirm whenever those assemblies were added.

    We use vs2012 to create WPF 4.5 app and EF5, if I have misunderstood anything, please feel free to let me know.

    There are some actions for you to build a clean project.

    Please take the following steps:

    1. We should to check out the Add-Ins and remove them. How to: Deactivate and Remove an Add-In.
    2. Rebuild VS templates.
    3. Create a WPF 4.5 app.
    4. Add the Entity Framework by using NuGet package. How to do this. Follow the third step.

    In addition, I’d like to refer you How to install NuGet.

    I hope this will help resolve your problem. But if it does not work, I suggest you to Repair Visual Studio or reinstall it.

    Best Regards,

    Tuesday, August 6, 2013 7:44 AM
    Moderator
  • Hello,

    Thanks for your reply. I'm using VS 2012 Express for Desktop which doesn't support add-ins. I did install EF 5.0 with Nuget. I also noticed that my program loaded OracleClient before when I used EF 4.0, both with VS 2010 Professional, and VS 2010 Express. So I don't think this is a "repair" issue because it's been observed with 3 VS installations.

    Do you think there are any scenarios where System.Web, System.Data.OracleClient, System.EnterpriseServices are loaded dynamically?

    I'm at a different machine now and happen to notice the OracleClient section in machine.config. However, a WPF app on this machine isn't loading it.

    Tuesday, August 6, 2013 2:16 PM
  • Hi Scottz1,

    Thanks for your clarification. I am now working with Hetro to help you solve the problem.

    For your question:

    Q: “Do you think there are any scenarios where System.Web, System.Data.OracleClient, System.EnterpriseServices are loaded dynamically?”

    A: Per my experience, there are 3 possible scenarios:

    1. There are some third-party staff hook on VS and will load some assemblies.
    2. VS project templates is not the default one.
    3. There is an assembly in your project has these dependencies, and you modified it before to avoid loading these assemblies. But you application still reference to the old version. When you copy the project to another PC, it cannot find the old one and got the new version loaded. It’s really hard to say what it is, but need to check your project.

    To better understand this problem, please help me confirm if you have done the following tests in case we missed something. If not, please try them and let me know the result. I understand perform these tests may spend lot of time, but I believe it will help us find the issue. Thanks for your cooperation.

    1. On the problematic PC, check if the project has same dlls loaded when start debugging in both VS 2010 Professional, and VS 2010 Express.  If you can provide a copy of the output here, it will be more helpful.

    2. Close all Visual Studio, Open VS command prompt and type the following command, which will be helpful to check if there is any problem during VS starting. Please share the log to me via Skydrive.

     devenv /log c:\vsloadmoreassembly.log

    3. Create a new WPF project on your problematic PC, and check if the debug output still show additional assemblies. This will help us to check if it is related to VS project templates.

    4. Open all project files, sub project files and config files in notepad to see if you can find the interest assemblies.

    Scottz1, if we can determine this issue is only related to your current project and it will not happen on other machines, I think it will not impact much on your business. However, if you do need to find out what is the root cause of this problem. I have 2 suggestions:

    1. Try to think about what you have changed and what you have configured on your projects by yourself, and remove the problematic staff. Actually, reinstall may be a quicker solution.
    2. Contact our phone support team at http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone. Which enables our engineer connect to your PC to help you find the problem.

    Look forward to hearing from you.

    Thanks,


    Alan Yao [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.




    Thursday, August 8, 2013 7:14 AM
  • Alan, thank you very much for your help. Please let me know how to contact you on skydrive. I will send you the log, and the dependency report from CheckAsm. Just installed VS 2013 preview and I'll let you know the results shortly.
    Thursday, August 8, 2013 3:33 PM
  • Alan, Hetro:

    I get the same issue with 2013 Express for Desktop Preview, in both debug and release builds.

    I ran CheckAsm on my 2013 exe and studied the output closely. The following assemblies are loading 2 versions. The older versions are dependencies of a 3rd party dll which was compiled some time ago so I will try to rebuild it targeting .NET 4.5:

    System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL

    System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=AMD64

    System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL

    System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL

    mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=AMD64

    Notice that 2 of those are for AMD64. What are the ramifications of that?

    But that still doesn't directly answer the question about the 3 (unused?) system assemblies, in bold below. Here's the VS 2013 output window when the program runs (my own assemblies deleted):

    'app.vshost.exe' (CLR v4.0.30319: app.vshost.exe): Loaded 'C:\trunk\app\app\bin\Release\Microsoft.Practices.Unity.dll'. Cannot find or open the PDB file.
    'app.vshost.exe' (CLR v4.0.30319: app.vshost.exe): Loaded 'C:\trunk\app\app\bin\Release\EntityFramework.dll'. Cannot find or open the PDB file.
    'app.vshost.exe' (CLR v4.0.30319: app.vshost.exe): Loaded 'Anonymously Hosted DynamicMethods Assembly'.
    'app.vshost.exe' (CLR v4.0.30319: app.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.Entity\v4.0_4.0.0.0__b77a5c561934e089\System.Data.Entity.dll'. Cannot find or open the PDB file.
    'app.vshost.exe' (CLR v4.0.30319: app.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework.Aero\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.Aero.dll'. Cannot find or open the PDB file.
    'app.vshost.exe' (CLR v4.0.30319: app.vshost.exe): Loaded 'C:\trunk\app\app\bin\Release\Visiblox.Charts.dll'. Module was built without symbols.
    'app.vshost.exe' (CLR v4.0.30319: app.vshost.exe): Loaded 'C:\trunk\app\app\bin\Release\System.Windows.Controls.DataVisualization.Toolkit.dll'. Cannot find or open the PDB file.
    'app.vshost.exe' (CLR v4.0.30319: app.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\System.Transactions\v4.0_4.0.0.0__b77a5c561934e089\System.Transactions.dll'. Cannot find or open the PDB file.
    'app.vshost.exe' (CLR v4.0.30319: app.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll'. Cannot find or open the PDB file.
    'app.vshost.exe' (CLR v4.0.30319: app.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\System.Data.OracleClient\v4.0_4.0.0.0__b77a5c561934e089\System.Data.OracleClient.dll'. Cannot find or open the PDB file.
    'app.vshost.exe' (CLR v4.0.30319: app.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll'. Cannot find or open the PDB file.
    'app.vshost.exe' (CLR v4.0.30319: app.vshost.exe): Loaded 'C:\trunk\app\app\bin\Release\Xceed.Wpf.Toolkit.dll'. Cannot find or open the PDB file.
    'app.vshost.exe' (CLR v4.0.30319: app.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll'. Cannot find or open the PDB file.
    'app.vshost.exe' (CLR v4.0.30319: app.vshost.exe): Loaded 'EntityFrameworkDynamicProxies-ATP.Data'.
    'app.vshost.exe' (CLR v4.0.30319: app.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll'. Cannot find or open the PDB file.
    'app.vshost.exe' (CLR v4.0.30319: app.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemXmlLinq\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemXmlLinq.dll'. Cannot find or open the PDB file.
    'app.vshost.exe' (CLR v4.0.30319: app.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemXml\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemXml.dll'. Cannot find or open the PDB file.
    'app.vshost.exe' (CLR v4.0.30319: app.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemData\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemData.dll'. Cannot find or open the PDB file.

    Thursday, August 8, 2013 4:09 PM
  • From the trace I think this baby is the root cause:

    Xceed.Wpf.Toolkit.dll

    But maybe not, as it seems more related to EF.  Download the Fusion loader tool and maybe it will help you out.

    The loader will load assemblies based on the manifest.  It knows all about dependencies within each dll, so, it finds those references and goes and gets them!


    JP Cowboy Coders Unite!




    Thursday, August 8, 2013 4:20 PM
  • After downloading source code for Unity 3, Service Locator, and 2 other 3rd-party dll's, and rebuilding everything to target .NET 4.5, I was able to eliminate all of the following assemblies:

     System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL
     System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=AMD64
     System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL
     System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL
     mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=AMD64

    But VS still shows the program loading the 3 dll's in the subject line, but CheckAsm doesn't show them.

    Thursday, August 8, 2013 9:11 PM
  • The Reflector tool just tells me that System.Data.dll or System.Transactions.dll references System.EnterpriseServices.dll, and in System.Data.dll, one internal method may load System.Data.OracleClient.dll dynamically. (just use reflector tool to reflect the code of .Net, not an official source code)

    So for checking your issue, I suggest to remove some independent code, and share the code with us, we may help you to verify the reference map of the code.


    Bob Bao

    Do you still use the same Windows 8 LockScreen always? Download Chameleon Win8 App quickly, that changes your LockScreen constantly.
    你是否还在看着一成不变的Windows 8锁屏而烦恼,赶紧下载这个 百变锁屏 应用,让你的锁屏不断地变化起来。


    Monday, August 12, 2013 3:26 AM
  • Thanks Bob. That's interesting. The app uses System.Data in a few assemblies and the code would be too large to share. I'm definitely NOT using Oracle, so I need to find a way to eliminate loading it. Does Reflector give you the name of the internal method that loads it, or can you detect methods that call that method?

    Any thoughts on system.web? Why would a wpf app need it?

    Thanks!

    Monday, August 12, 2013 3:32 AM
  • The internal method is used by two public Methods:

    but I think here is not good to share any reflected code.

    And for Web, if the app requests any web operation, the assembly should be used.


    Bob Bao

    Do you still use the same Windows 8 LockScreen always? Download Chameleon Win8 App quickly, that changes your LockScreen constantly.
    你是否还在看着一成不变的Windows 8锁屏而烦恼,赶紧下载这个 百变锁屏 应用,让你的锁屏不断地变化起来。

    Monday, August 12, 2013 4:14 AM
  • Thanks. I still need to figure out how to configure .NET so it won't load OracleClient or System.Web. My program doesn't use any web interfaces (http://msdn.microsoft.com/en-us/library/system.web.aspx), or use Oracle, and none of the projects has a reference to these assemblies. So something in .NET is dynamically loading them.
    Monday, August 12, 2013 1:33 PM
  • Did you use the Fusion tool to see the assembly loading?

    Also you could use Windbg to see when it is loaded too.


    JP Cowboy Coders Unite!

    Monday, August 12, 2013 10:47 PM