EFTools compile errors

Topics: EF Designer, General
Apr 22 at 7:00 PM
Hi,
When I try to compile EFTools.
1st i get the following error:
MSBUILD : error CA1709: Microsoft.Naming : Correct the casing of 'Db' in namespace name 'Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb' by changing it to 'DB'. [C:\Projects\EntityFramework\eftestfix\src\EFTools\EntityDesignerVersioningFacade\EntityDesignerVersioningFacade.csproj]
I can't find this in the known issues.

So i disabled the code analisys. Then
I get 10 test failures (all of them from ShellSettingsManager).
How can I fix them (without disabling them:))?

Test assembly: C:\Projects\EntityFramework\eftestfix\test\EFTools\UnitTests\bin\Debug\EFDesigner.UnitTests.dll
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Gui.WizardPageStartTests.OnDeactivate_updates_model_settings_if_model_file_does_not_exist_for_generate_from_database: System.Reflection.TargetInvocationException : A megh¡vott objektum kiv‚telt v ltott ki.
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : ---- System.NotSupportedException : Microsoft.VisualStudio.Shell.Interop.SVsSettingsManager
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: System.Activator.CreateInstance(Type type, Object[] args)
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: Castle.DynamicProxy.ProxyGenerator.CreateClassProxyInstance(Type proxyType, List1 proxyArguments, Type classToProxy, Object[] constructorArguments)
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options, Object[] constructorArguments, IInterceptor[] interceptors)
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: Moq.Proxy.CastleProxyFactory.CreateProxy[T](ICallInterceptor interceptor, Type[] interfaces, Object[] arguments)
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: Moq.Mock
1.<InitializeInstance>b__0()
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: Moq.PexProtector.Invoke(Action action)
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: Moq.Mock1.InitializeInstance()
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: Moq.Mock
1.OnGetObject()
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: Moq.Mock`1.get_Object()
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Gui.WizardPageStartTests.OnDeactivate_updates_model_settings_if_model_file_does_not_exist_for_generate_from_database() hely: c:\Projects\EntityFramework\eftestfix\test\EFTools\UnitTests\EntityDesign\VisualStudio\ModelWizard\Gui\WizardPageStartTests.cs, sor: 160
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : ----- Inner Stack Trace -----
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: Microsoft.VisualStudio.Shell.Settings.ShellSettingsManager..ctor(IServiceProvider serviceProvider)
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: Microsoft.VisualStudio.PlatformUI.DpiHelper.get_ImageScalingMode()
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: Microsoft.VisualStudio.PlatformUI.DpiHelper.CreateDeviceFromLogicalImage(ImageList logicalImageList, Color backgroundColor, ImageScalingMode scalingMode)
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: Microsoft.VisualStudio.PlatformUI.DpiHelper.LogicalToDeviceUnits(ImageList& imageList, Color backgroundColor, ImageScalingMode scalingMode)
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: Microsoft.VisualStudio.PlatformUI.DpiHelper.LogicalToDeviceUnits(ImageList& imageList, ImageScalingMode scalingMode)
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Gui.WizardPageStart..ctor(ModelBuilderWizardForm wizard, ConfigFileUtils configFileUtils) hely: c:\Projects\EntityFramework\eftestfix\src\EFTools\EntityDesign\VisualStudio\ModelWizard\gui\WizardPageStart.cs, sor: 79
C:\Projects\EntityFramework\eftestfix\EFTools.msbuild(138,9): error : a k”vetkez‹ helyen: Castle.Proxies.WizardPageStartProxy..ctor(IInterceptor[] , ModelBuilderWizardForm , ConfigFileUtils )

Thanks,
zgabi
Coordinator
Apr 22 at 9:02 PM
Edited Apr 23 at 5:50 AM
Hi zgabi,

The first issue with the code analysis seems similar to a problem that ErikEJ reported previously in which in a machine that had VS 2010 installed the wrong set of rules (or even the wrong set of code analysis tools) were picked up by the build. The capitalization rule has been updated to allow 'Db' as the an abbreviation of a single word 'Database' in more recent versions of VS.

I am not sure about the second issue. I can see the TargetInvocationException at the top of the stack. Could you please tell me what the message is for the inner exception? My guess is that this coming from VS and it might be possible that this also had to do with older versions of the libraries being present in your machine.

Hope this helps,
Diego
Apr 22 at 9:19 PM
Hi,

I don't have any old VS.
I have a clean install of Win8.1 Update (x64, Hungarian), SQL 2014, Office 2013, VS2013 + Other tools which is required for building EF (SqlCompact 3.5 is the only old sw). I haven't installed any old MS software, but I can see an "MS Visual Studio 2010 Tools for Office Runtime x64" in add/remove programs. It was installed with Office 2013 or SQL 2014. So never installed VS 2010 or 2012 to this OS.

I'll check the 2nd issue.

Gábor
Apr 22 at 9:45 PM
The exception message is:
"Microsoft.VisualStudio.Shell.Interop.SVsSettingsManager"

When I change the following line in WizardPageStart.cs:
        DpiHelper.LogicalToDeviceUnits(ref imageList);
to:
        DpiHelper.LogicalToDeviceUnits(ref imageList, ImageScalingMode.Bicubic);
then it works.
Apr 22 at 9:59 PM
I also have MS VS 2010 Shell (Isolated) installed. I checked the creaton dates of the folders. It was created 5 minutes before the 1st subfolder in VS 12.0 folder. So -probably it was installed by VS2013 (as a prerequisite).
Apr 23 at 7:59 AM
Edited Apr 23 at 8:34 AM
The VS 2010 is installed by SQL Server (Management Studio)

And I can build without CA errors using "Developer Command Prompt for VS 2013" - I have Update 2 RC installed

(And I have VS 2008 and onwards installed)
Coordinator
Apr 23 at 9:58 AM
Edited Apr 23 at 4:45 PM
Thanks zgabi for the additional information. I just wanted to let you know that I was able to repro the second issue and that the exception on DpiHelper.LogicalToDeviceUnits(ref imageList) was a good hint.

This method is used (only in the Visual Studio 2013 version of the designer) to scale image elements according to the UI scaling setting from Windows (usually established in Control Panel\Appearance and Personalization\Display). With the overload that doesn't take the scaling mode as a parameter VS will not only calculate the most crisp looking scaling mode and the scale but will also check the registry for user overrides.

Apparently, when executing the code of the WizardStartPage from a test, the whole VS environment isn't correctly configured and therefore the service used to read the values from the registry isn't available, hence the exception. This also seems to happen only if the Windows settings for the user account is configured to a scaling percentage different from 100%.

I still haven't found a good fix for the test, but could you check what scaling percentage you have configured in Windows and whether setting it to 100% removes the exceptions? Keep in mind that if you change the UI scaling setting you will have to log out from your Windows account to make the change effective.

Thanks ErikEJ for the additional information.

Thanks,
Diego
Apr 23 at 5:32 PM
ErikEJ: I have only Update 1 for VS 2013, and still have CA errors when try to compile it using "Developer Command Prompt for VS 2013", so I disabled RunCodeAnalysisForEFTools.

divega: I had a "Medium" scaling percentage. (Which is probably 125%, and it was the default on my 1920x1080 screen resolution). I've modified it to "Smaller" (which is probably 100%), and now there is no unit test error.

Thanks,
Gábor
Coordinator
Apr 23 at 7:41 PM
Hi Gábor,

Thanks for confirming. I have created a bug for the second issue:

https://entityframework.codeplex.com/workitem/2239

Please let me know if you get any insights on the first issue. Other than that, I think disabling RunCodeAnalysisForEFTools if it fails is a reasonable workaround for the purpose of verifying your pull requests don't break anything.

Thanks,
Diego
Apr 24 at 5:29 PM
Hi,

I have added the following line to "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\FxCop\CustomDictionary.xml"
<Acronyms>
<CasingExceptions>
  <Acronym>Db</Acronym> <-- this line
  ...
</CasingExceptions>
</Acronyms>

Now it compiles without CA error.

ErikEJ: Please could you send me your CustomDictionary.xml file? Or if it is possible the whole FxCop folder.

Thank you,
Gábor
Apr 25 at 9:11 AM
@zgabi - the CodeAnalysisDictionary.xml file in the EF src folder contains:
<?xml version="1.0" encoding="utf-8"?>

<Dictionary>
    <Words>
        <Recognized>
            <Word>asax</Word>
            <Word>ce</Word>
            <Word>composable</Word>
            <Word>csdl</Word>
            <Word>__db__</Word>
Could it be that this file is not picked up during code analysis from command line?