Dominique
Dominique

Reputation: 17565

What's the purpose of Telerik's OpenAccess enhancer?

Last year, I had a problem concerning Telerik OpenAccess enhancer. That was a very unstable situation: once it worked, sometimes not, ...

Now I have another problem, also about Telerik OpenAccess enhancer, but this time the problem is very clear:

This gives me a clear situation and I would like to profit of this situation to firmly understand what Telerik OpenAccess enhancer is about and how corresponding problems can be tackled. Hence my first question: What is Telerik OpenAccess enhancer exactly?

I had a look inside the *.csproj file and I've found the following property group:

<PropertyGroup>
  <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
  <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
...
    <EnhancerAssembly>
        $(SolutionDir)\packages\Telerik.DataAccess.Fluent.2016.2.822.1\
        tools\enhancer\enhancer.exe
    </EnhancerAssembly>
</PropertyGroup>

In both cases, this are the used build settings:

Build settings

As far as my problem is concerned: I have built my project in six ways: in Visual Studio 2017 and in Visual Studio 2022, using three MSBuild build verbosities: Normal, Detailed and Diagnostics.
I'm planning to start with the normal case (where differences are already visible), investigate those differences and try to dig deeper as I go.

Hereby the compiler output in VS2017:

2>OpenAccessEnhancer:
2>  "C:\<Source_Dir>\Project.<Customer>\<Product>\packages\Telerik.DataAccess.Fluent.2016.2.822.1\tools\enhancer\enhancer.exe"
      -verboseMode:3
      -assembly:"C:\<Source_Dir>\Project.<Customer>\<Product>\<Product>.<Customer>.Server\obj\Debug\<Product>.<Customer>.Server.dll"
      -reference:<list of project references>
      -attributeMapping
      -fluentMapping
2>  Telerik AD Telerik Data Access Enhancer, Version 2016.2.822.1, Copyright (C) 1996-2016 Telerik AD. All rights reserved.
2>  Creating "obj\Debug\<Product>.<Customer>.Server.oa" because "AlwaysCreate" was specified.
2>  The project was successfully enhanced by Telerik OpenAccess ORM Enhancer 2016.2.822.1
2>_CopyFilesMarkedCopyLocal:
2>  Creating "C:\<Source_Dir>\Project.<Customer>\<Product>\<Product>.<Customer>.Server\obj\Debug\<Product>.<Customer>.Server.csproj.CopyComplete" because "AlwaysCreate" was specified.
2>_CopyAppConfigFile:
2>  Copying file from "app.config" to "..\..\..\Site\<Product> Server\Modules\<Product>.<Customer>.Server.dll.config".
2>CopyFilesToOutputDirectory:
2>  Copying file from "obj\Debug\<Product>.<Customer>.Server.dll" to "..\..\..\Site\<Product> Server\Modules\<Product>.<Customer>.Server.dll".
2>  <Product>.<Customer>.Server -> C:\<Source_Dir>\Site\<Product> Server\Modules\<Product>.<Customer>.Server.dll
2>  Copying file from "obj\Debug\<Product>.<Customer>.Server.pdb" to "..\..\..\Site\<Product> Server\Modules\<Product>.<Customer>.Server.pdb".
2>
2>Build succeeded.

Hereby the compiler output in VS2022:

2>OpenAccessEnhancer:
2>  "C:\<Source_Dir>\Project.<Customer>\<Product>\packages\Telerik.DataAccess.Fluent.2016.2.822.1\tools\enhancer\enhancer.exe"
      -verboseMode:3
      -assembly:"C:\<Source_Dir>\Project.<Customer>\<Product>\<Product>.<Customer>.Server\obj\Debug\<Product>.<Customer>.Server.dll"
      -reference:<list of project references>
      -attributeMapping
      -fluentMapping
2>  Telerik AD Telerik Data Access Enhancer, Version 2016.2.822.1, Copyright (C) 1996-2016 Telerik AD. All rights reserved.
2>C:\<Source_Dir>\Project.<Customer>\<Product>\<Product>.<Customer>.Server\obj\Debug\<Product>.<Customer>.Server.dll(-1,-1):
    OpenAccess Enhancer error 0: The specified assembly 'C:\Users\DDM\AppData\Local\Temp\_ptil_37352\<Product>.<Customer>.Server.dll' cannot be loaded.
    The problem might be that the enhancer runs in a .NET framework 2.0 vm and the assembly to enhance is a .NET 4.0 assembly or 
    you are trying to enhance a x86 assembly in a 64 bit process or a x64 assembly in a 32 bit process.
    Please change the required version inside the enhancer.exe.config or venhance.exe.config or switch to 'Any CPU' for this project.
2>
2>Build FAILED.

These differences already raise some new questions:

  1. I am running exactly the same commandline command, one from VS2017, the other from VS2022, and the behaviour is different. This means that trying to solve this issue using basic commandline is useless as both VS2017 and VS2022 seem to have some different environment variables. Which are they?
    Edit: when launching the command in Windows commandline, the same error message is seen as in VS2022.
  2. The VerboseMode, used in the enhancer, equals 3. The "manpage" of the enhancer gives no information (-verboseMode:<value> Verbose mode (default: 0)). What is the value for maximal verbosity and how can I configure this?
  3. Some *.oa file is created because AlwaysCreate was specified. A WSL search in the project directory reveals the following:
./<Product>/<Product>.<Customer>.Server/OpenAccessNuGet.targets:
  <Touch AlwaysCreate="true" Files="@(EnhancementFlagFile)" Time="%(IntermediateAssembly.ModifiedTime)" />
./<Product>/packages/Telerik.DataAccess.Fluent.2016.2.822.1/content/OpenAccessNuGet.targets:
  <Touch AlwaysCreate="true" Files="@(EnhancementFlagFile)" Time="%(IntermediateAssembly.ModifiedTime)" />

Which AlwaysCreate are we talking about here?

Update

Spoiler alert:

Extra update

The description of the compiler error message is the following:

The specified assembly C:\Users\DDM\AppData\Local\Temp\_ptil_xxxxx\<Product>.Server.dll cannot be loaded. The problem might be that the enhancer runs in a .NET framework 2.0 vm and the assembly to enhance is a .NET 4.0 assembly or you are trying to enhance a x86 assembly in a 64 bit process or a x64 assembly in a 32 bit process.
Please change the required version inside the enhancer.exe.config or venhance.exe.config or switch to 'Any CPU' for this project.

How to understand this error message:

  1. There is a way to modify the file "enhancer.exe.config" or "venhance.exe.config", this is the way to do it: ...
  2. There is a more recent version of Telerik OpenAccess which does not have this issue. The Telerik OpenAccess version you need is ...
  3. Forget it! VS2022 is 64-bit and you must never try to build a 32-bit application, based on Telerik OpenAccess!

Which one is it and if needed, how can I fill in the ellipsis?

Upvotes: 0

Views: 64

Answers (0)

Related Questions