Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Frequent Contributor
Posts: 119
Registered: ‎04-05-2016

GMSC 16.5 assemblies moved to bin folder

Hello,

 

in the GMSC 16.5 release the GMSC dependent assemblies are no longer registered in the .NET assembly cache. instead they are held in the bin folder of the GMSC installation base path.

 

Is there any reasoning behind this decision? This is actually giving developers like me who used to reference these assemblies from the assembly cache a lot more trouble.

 

Thanks and kind regards,

Sven

Regular Contributor
Posts: 183
Registered: ‎11-17-2015

Re: GMSC 16.5 assemblies moved to bin folder

Hello Sven,

 

I tried to create a ValueProvider in 16.5 (referencing the 16.5 dll in visual studio).

When trying to use it in my WF I get the message: "Cannot load type GRValueProviders".

Do you think it is related to your problem? Did you face the same issue?

 

Thank you.

Yohann.

Frequent Contributor
Posts: 119
Registered: ‎04-05-2016

Re: GMSC 16.5 assemblies moved to bin folder

[ Edited ]

Hi Yohann,

 

if you don't publish the referenced dlls with your application you will most likely run into such problems.

You can either:

 

  1. Publish the referenced GMSC 16.5 dlls together with your application (deliver them together with the application's own assemblies)
  2. Reference the respective bin directory of the GMSC 16.5 installation during runtime before any part of your application actually refers to them like this:
private static Assembly CurrentDomainOnAssemblyResolve(object sender, ResolveEventArgs args)
{
Assembly result = null;
var baseDir = SmartClientAppSettings.GetApplicationPath(SmartClientAppCode.SmartClient) + "\\bin";
try
{
String[] files = Directory.GetFiles(baseDir, (new AssemblyName(args.Name)).Name + ".dll", SearchOption.AllDirectories);
if (files.Length == 0)
{
files = Directory.GetFiles(baseDir, (new AssemblyName(args.Name)).Name + ".exe", SearchOption.AllDirectories);
}
bool found = false;
for (int i = 0; i < files.Length && !found; i++)
{
result = Assembly.LoadFrom(files[i]);
found = true;
}
}
catch (Exception exception)
{
//log your exception here
}
return result;
}

and call the method to load the assemblies manually as early as possible during startup of your application:

AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve;

In this example you need at least the reference to the Intergraph.Emea.Configuration assembly. If you don't want to publish it with your application you have to hardcode the GMSC installation path.

 

Hope that helps.

 

Regards,

Sven

 

Regular Contributor
Posts: 183
Registered: ‎11-17-2015

Re: GMSC 16.5 assemblies moved to bin folder

Hello Sven,

 

I copy my value provider dll in the folder C:\Program Files\Intergraph\GeoMedia SmartClient\Program\Workflows\bin.

This directory already contains the dll I have referenced in my value provider (Intergraph.Emea.Configuration / Core / Data / SecurityBase / Workflows.dll).

 

I tried by dynamically load like you mentionned but same error:

PropertyName: DefaultValue
PropertyValue: OBJECT[GRValueProviders.GetValue({FORM.RolesParcelleStr})]
ResolveError: Cannot load type GRValueProviders.

 

I call my value provider in my WF like defaultvalue="OBJECT[GRValueProviders.GetValue({FORM.RolesParcelleStr})]".

 

I used to do like this in previous version without problem.

Other idea? Did I missed something?

 

Yohann.

Frequent Contributor
Posts: 119
Registered: ‎04-05-2016

Re: GMSC 16.5 assemblies moved to bin folder

Hi Yohann,

 

I think in this case, you have a different problem than me.

 

Am I right, that "GRValueProviders" is your custom valueprovider class? I am not very experienced with workflows but it looks to me that you dll is not loaded or the class can't be found by the name GRValueProviders.

 

I found an implementation of an IValueProvider interface in one of my programs and it is working fine with GMSC 16.5. Are you sure, the spelling in your workflow is correct?

 

Can you post the implementation of your ValueProvider?

 

Regards,

Sven

Regular Contributor
Posts: 183
Registered: ‎11-17-2015

Re: GMSC 16.5 assemblies moved to bin folder

Hi Sven,

 

You were right, the problem was on my side.

I fogot to declare the ExtensibleType for my class.

My apologize, thank you for pointing me on the right direction.

 

Regards,

Yohann.

Highlighted
Frequent Contributor
Posts: 119
Registered: ‎04-05-2016

Re: GMSC 16.5 assemblies moved to bin folder

Hi Yohann,

 

no problem. I think you solved the problem by yourself ;-)

 

For anyone having similar issues like Yohann and stumbeling upon this:

He forgot to put the [ExtensibleType()] declaration for his IValueProvider implementation like so:

 

[ExtensibleType("MyCustomProvider")]
public class MyCustomProvider : IValueProvider 
{...}

Regards,

Sven