locked
Module not found/0x8007007E error when using BooleanToVisibilityConverter

    Question

  • I'm working on a C++ Windows Store app. When I want to make use of the BooleanToVisibilityConverter from the common-namespace, something strange happens. In Visual Studio's XAML editor the whole control or data template where I use it becomes underlined blue. Hovering over that states "Cannot create instance of type 'MyApp.Common.BooleanToVisibilityConverter'".

    This is how I use it (inside a DataTemplate): 

    <Grid Visibility="{Binding ShouldBeShown, Converter={StaticResource booleanToVisibilityConverter}}" />


    The Converter itself is defined in a ResourceDictionary:

    <ResourceDictionary
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:MyApp"
        xmlns:common="using:MyApp.Common">
        
        <common:BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter"/>
    
    <!-- ... -->

    In here, the converter ist underlined in blue, too. Hovering over it shows: "The module couldn't be found. (Exception of HRESULT: 0x8007007E)". But I'm just using the default convert automatically added by Visual Studio.

    The ResourceDictionary is used in App.xaml:

    <Application
        x:Class="MyApp.App"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:MyApp">
    
        <Application.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
    
                    <!-- 
                        Styles that define common aspects of the platform look and feel
                        Required by Visual Studio project and item templates
                     -->
                    <ResourceDictionary Source="Common/StandardStyles.xaml"/>
                    <ResourceDictionary Source="Dictionary.xaml"/>
                </ResourceDictionary.MergedDictionaries>
    
            </ResourceDictionary>
        </Application.Resources>
    </Application>

    The app itself is running fine and the converter works correctly. It's just the XAML editor having issues. What can I do about that? Having all DataTemplate code underlined blue is very annoying. ;)

    Monday, July 22, 2013 10:05 AM

All replies

  • I have seen this behavior too.  It is as if the xaml designer remembers some error condition and does not clear it when the code is correct.

    The last time, it appeared for me, I fixed it by re-typing the offending xaml references and letting Intellisense fill in as much as possible.  Even though the code appeared the same, the error cleared.

    Start with the xmlns, then the common:BooleanToVisibilityConverter.

    Monday, July 22, 2013 12:18 PM
  • I tried that, but it didn't help, unfortunately. I even deleted the intellisense database of the project - no success.
    Monday, July 22, 2013 1:32 PM
  • Try adding this to your App.xaml.h file

    #include "Common\BooleanToVisibilityConverter.h"

    and ReBuild.

    That fixed the error when I tried to repro.

    (You may need this in other pages that use the converter as well.)


    • Edited by jrboddie Monday, July 22, 2013 2:38 PM added
    Monday, July 22, 2013 2:22 PM
  • I put the include there and the other pages, I even tried putting it into pch.h, but it didn't help.

    Monday, July 22, 2013 2:56 PM
  • Sorry to hear that.  At one point in my tries, I saw exactly the same error, but fixed it by a combination of adding the #include, rebuilding (not just "building"), cleaning and reentering the references with Intellisense autofill.
    Monday, July 22, 2013 3:11 PM
  • Ok.  I removed the #include, rebuilt and got the error.

    I added the #include and still got the error.

    To fix it, I removed the

    <common:BooleanToVisibility... in the Resource Dictionary

    then rebuilt the solution to get no error.

    Then re-added the <common:BooleanToVisibility... using Intellisense autofill

    Rebuilt and the error was cleared.

    So the key seems to be:

    1. Remove the <common: reference (and possibly references to the converter elsewhere)
    2. Add the #includes
    3. get a clean build
    4. add the <common: reference in the resource file.

    A designer bug to be sure!



    • Edited by jrboddie Tuesday, July 23, 2013 2:56 AM added detail
    Monday, July 22, 2013 3:24 PM
  • I'm afraid this didn't help either. 

    I wanna thank you for you efforts anyway.

    Tuesday, July 23, 2013 11:40 AM