none
Tricky question. I get a strange compile error with Compact Framework, it shows in .Net Framework 4.6.1 but not in .Net Framework 4 RRS feed

  • Question

  • One simple proj.

    Using System.Linq and CommonLib, the last one is a shared namespace between two assemblies referenced in the project: CommonLib(this is referencing WPF-assemblies) and CommonLibCompactFramework which utilizes Compact Framework(no wpf reference).

    The c#-project is utilizing Compact Framework too.

    Now if I run 4.6.1 with the code below in my proj, I get the errors below. But if I run .Net 4.0, it compiles:

    - The type 'System.Windows.DependencyObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

    - The type 'System.Windows.Media.Transform' is defined in an assembly that is not referenced. You must add a reference to assembly 'PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

    It also compiles if I would remove the "using System.Linq"(and the code) or the "using CommonLib". it also compiles if I just remove the "return coll.Where(o => o == "o");" - line and leave the using System.Linq.

    Code:

    using System.Linq;

    using CommonLib;

    namespace ABC

    {

       public class MyClass

       {

           public static object MyMethod()

           {

               List<string> coll = new List<string>();
                return coll.Where(o => o == "o");
                return "o";

           }

       }

    }

    This has gotten me very confused, anyone got an idea what the reason could be ?




    • Moved by Michel VerhagenMVP Friday, January 12, 2018 9:16 PM Question posted in wrong forum
    Friday, January 12, 2018 12:20 PM

All replies

  • You are posting this in the wrong forum. This forum is for smart device development. In other words; it's for questions regarding the .NET Compact Framework. Your question is dealing with the Full .NET Framework.

    I'll move it to a better forum for you.


    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: https://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    NXP Proven Partner
    https://guruce.com
    Consultancy, training and development services.

    Interested in WEC on i.MX6?
    Get the only 100% stable and best performing i.MX6 BSP for WEC7 and WEC2013 here: https://guruce.com/imx6

    Friday, January 12, 2018 9:15 PM
  • Hi Knorre1,

    I test the code you provide with .net framework 4.6.1 and .net framework 4.0. There is no compiler error. Could you provide the sample code which could produce the error?

    Best Regards,

    Wendy



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 22, 2018 8:08 AM
    Moderator