Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / c# dll successfully ad...
Finance forum
Answered

c# dll successfully added as a reference but can't be used in code

Posted on by 45

Hi,

I'm using Visual Studio 2019 and, although I successfully added a reference to Gembox.Document.dll targeting .NET Framework 3.5-4.8, It's "not available" in a FinOps class, but I have no problem using it in a C# class. I've even tried with older versions or .NET standard 2.0.

What am I missing?

pastedimage1656346386920v3.png

pastedimage1656346111706v1.png

pastedimage1656346247315v2.png

  • Martin Dráb Profile Picture
    Martin Dráb 229,247 Most Valuable Professional on at
    RE: c# dll successfully added as a reference but can't be used in code

    Thank you for letting us know. This information may come in useful one day...

  • Verified answer
    Alexban Profile Picture
    Alexban 45 on at
    RE: c# dll successfully added as a reference but can't be used in code

    I've worked with Gembox support and tried a lot of versions until I found the latest working with D365FO; with this information, Gembox support identified the reason: they started annotating their API to support nullable reference types. Microsoft support official answer is that Nullable reference types are not yet available (no eta) in the x++ compiler and are not supported with Dynamics in the same way c# does.

    Hopefully, this will help someone else ...

    Thank you Martin for your continuous support for the community!

  • Alexban Profile Picture
    Alexban 45 on at
    RE: c# dll successfully added as a reference but can't be used in code

    I don't know how I missed you answer Martin... I've got assembly binding to produce some output but there was nothing about Gembox.Document so I've opened a ticket with Microsoft support 5 days ago and I'm still waiting for the initial answer; I'll update this thread once I have some relevant info.

  • Martin Dráb Profile Picture
    Martin Dráb 229,247 Most Valuable Professional on at
    RE: c# dll successfully added as a reference but can't be used in code

    I'm sorry, but I don't know why this assembly can't be loaded. If we had source code, I would try building it specifically for .NET 4. Because that's not an option, you can try asking Microsoft support.

    By the way, your assembly binding isn't working - you should get several binding failures from the standard solution. Either you didn't configure it correctly, didn't refresh the result or you didn't provide any relevant action since activating the log. Note that you mentioned IIS, but that's not relevant to this problem. Development is done in Visual Studio and compilation is done by xppc. IIS or IIS Express would be used to run your code if it was compilable, but that isn't the case.

    Unfortunately the log didn't help me much in this case. I got one failure related to GemBox, but when I fixed it, VS still complained that the type or namespace could not be found.

  • Alexban Profile Picture
    Alexban 45 on at
    RE: c# dll successfully added as a reference but can't be used in code

    any ideas what else I could try (or retry)?

  • Alexban Profile Picture
    Alexban 45 on at
    RE: c# dll successfully added as a reference but can't be used in code

    Thank you for taking time to answer, Martin!

    I didn't realize about the References node in AOT...

    pastedimage1656396969952v1.png

    the download page for the assembly (https://www.gemboxsoftware.com/document/downloads/bugfixes.html) shows 3 versions and I've tried the .NET framework 3.5 - 4.8 version (and .NET Standard 2.0 one, just because I was running out of ideas...)

    pastedimage1656397075491v2.png

    according to https://www.nuget.org/packages/GemBox.Document/#dependencies-body-tab there's just one dependency on BouncyCastle,Crypto, witch I already have

    pastedimage1656397260484v3.png

    I didn't know about Assembly Binding Log Viewer; I've started it, restarted IIS but there's nothing in the log (I've set a custom log location but there's no log file written)

    pastedimage1656398887702v5.png

    I know I can create a c# project and add it as a reference in my finops project but, I already have lots of code using Gembox.Document, written for AX2009, and don't have to much time to change it...

  • Martin Dráb Profile Picture
    Martin Dráb 229,247 Most Valuable Professional on at
    RE: c# dll successfully added as a reference but can't be used in code

    You can see refences in the Application Explorer (AOT > References).

    What exactly is the target version used when building the assembly? What you showed is just the assembly description. It's not specific enough and it may be wrong, because it's set manually.

    Also, don't this assembly depend on other assemblies that you don't have in the F&O environment?

    Have you tried Assembly Binding Log Viewer?

  • Alexban Profile Picture
    Alexban 45 on at
    RE: c# dll successfully added as a reference but can't be used in code

    what do you mean? where should I look for this?

  • nunomaia Profile Picture
    nunomaia 10,684 Super User 2024 Season 1 on at
    RE: c# dll successfully added as a reference but can't be used in code

    Can you check if reference is added to model ?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,888 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,247 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans