Jira Integration: Initializer threw an exception

Ask general questions here.
xeronar
Posts: 28
Joined: Mon May 22, 2017 8:19 pm

Jira Integration: Initializer threw an exception

Post by xeronar » Wed Jun 28, 2017 11:20 am

Version: Ranorex 7.0.1
OS: Windows Server 2012 R2 Datacenter
JiraReporter Plugin version: 7.0.1.1

Hello guys,

I've installed the JiraReporter plugin via nuget. But everytime I run my tests I got this:

Code: Select all

The type initializer for 'JiraReporter.JiraReporter' threw an exception. (InnerException: System.IO.FileLoadException: Could not load file or assembly 'Atlassian.Jira, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Atlassian.Jira, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
 at JiraReporter.JiraReporter..cctor()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
 -- ) 
What I've done so far:
- I've changed my app.config to

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
    <supportedRuntime version="v2.0.50727" />
  </startup>
  <runtime>
  	<loadFromRemoteSources enabled="true" />
    <enforceFIPSPolicy enabled="false" />
  </runtime>
</configuration>
- all my .dll files do not have an unblock option in the properties section so i guess they are unblocked already

My packages.config looks like this:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Atlassian.SDK" version="9.2.4" targetFramework="net40" />
  <package id="Atlassian.SDK.Signed" version="9.2.3" targetFramework="net40" />
  <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net40" />
  <package id="Ranorex_JiraIntegration" version="7.0.1.1" targetFramework="net40" />
  <package id="RestSharp" version="105.2.3" targetFramework="net40" />
  <package id="RestSharpSigned" version="105.2.3" targetFramework="net40" />
  <package id="TechTalk.JiraRestClient" version="2.5.0" targetFramework="net40" />
  <package id="TechTalk.JiraRestClient.RestSharp105" version="2.3.0.1" targetFramework="net40" />
</packages>
Did I miss something like adding a certain .dll file? Do I have have to change the AssemblyInfo.cs or is it something completely different?

User avatar
qwertzu
Posts: 284
Joined: Wed Jan 25, 2017 11:08 am

Re: Jira Integration: Initializer threw an exception

Post by qwertzu » Thu Jun 29, 2017 12:24 pm

Hi xeronar,

It seems like the "Atlassian.Jira" reference could not be found.
Please see whether you can find this DLL in the references of your project.
Furthermore, you need to make sure that you have added the correct DLLs regarding your Ranorex Version as described in step 1 under the following link: https://www.ranorex.com/blog/integratin ... into-jira/

I hope, this helps.

regards,
qwertzu

xeronar
Posts: 28
Joined: Mon May 22, 2017 8:19 pm

Re: Jira Integration: Initializer threw an exception

Post by xeronar » Fri Jun 30, 2017 9:59 am

Hi qwertzu,

Thank you, the error message is gone now (got an atlassian.signed.sdk.dll and reinstalled everything with the right versions), but I got a new one :D

Code: Select all

Could not load file or assembly 'Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) (InnerException: -- ) 
This time the version of my Newtonsoft.Json.dll is 8.0.3 but I can't download the latest version 10.0.3 because of:

Code: Select all

Install-Package : The 'Newtonsoft.Json 10.0.3' package requires NuGet client version '2.12' or above, but the current NuGet version is '2.8.50126.400'.
So I went to Tools -> Options... -> Package Management -> Package Sources to check if I'm using the right source, the URL ishttps://www.nuget.org/api/v2/

On the nuget.org homepage in the section "NuGet Feed Locations", they say this is the right URL for NuGet 2.x. Should I try to download and install the new Json.dll manually or is there any trick to use NuGet 2.12 with Ranorex?

User avatar
qwertzu
Posts: 284
Joined: Wed Jan 25, 2017 11:08 am

Re: Jira Integration: Initializer threw an exception

Post by qwertzu » Fri Jun 30, 2017 10:09 am

Hello xeronar,

I´m glad, that the error message is gone now.
Unfortunately updating Nuget Package manager is not possible within Ranorex Studio.
I would suggest to add the reference manually.

regards,
qwertzu

xeronar
Posts: 28
Joined: Mon May 22, 2017 8:19 pm

Re: Jira Integration: Initializer threw an exception

Post by xeronar » Fri Jun 30, 2017 3:39 pm

Maybe this has something to do with the Ranorex 7.1 upgrade (I upgraded it yesterday), as I discovered a new thread (Ranorex 7.1 upgrade -- error) with the same problem on 7.1.

User avatar
qwertzu
Posts: 284
Joined: Wed Jan 25, 2017 11:08 am

Re: Jira Integration: Initializer threw an exception

Post by qwertzu » Mon Jul 03, 2017 12:47 pm

Hello xeronar,

I would suggest creating a new solution and going through the following blog post on how to integrate Ranorex Tests in Jira. Please see whether this works for you.
https://www.ranorex.com/blog/integratin ... into-jira/
Please also make sure to add the correct references as stated in this blog post. Usually this should work.

regards,
qwertzu

xeronar
Posts: 28
Joined: Mon May 22, 2017 8:19 pm

Re: Jira Integration: Initializer threw an exception

Post by xeronar » Wed Jul 05, 2017 9:55 am

Hi qwertzu,

I followed the steps on the blog post every time but there are problems as well. If I want to add the libraries to Ranorex for Jira Automation, the package manager can't even search it. I type "Ranorex Jira Reporter", then I click on search. After a few seconds I got the message "An error occured" every time, and searching the Jira Reporter manually in the package manager seems to be very tedious (I've searched about 60 sites in the manager and still no Ranorex Jira Reporter). So I decided to install the lib via console:

Code: Select all

Install-Package Ranorex_JiraIntegration -Version 7.0.1.1
But it still doesn't work. I got the same error message:

Code: Select all

Could not load file or assembly 'Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) (InnerException: -- ) 
I did the same steps as being listed in the blog post (adding <loadFromRemoteSources enabled="true" /> to the app.config and I also unblocked the .dlls) and replaced the old json.dll files with the new 10.3 .dll files. But nothing is working at the moment.

EDIT: I might know now why this is failing all the time. My Json.dll files in .../Ranorex7.1/bin and .../Ranorex7.1/RanorexStudio/Bin have the version 6.x, but when I replace them with with a newer version, Ranorex sends me a crash report and the remote agent panel won't show up... sigh :D

User avatar
qwertzu
Posts: 284
Joined: Wed Jan 25, 2017 11:08 am

Re: Jira Integration: Initializer threw an exception

Post by qwertzu » Thu Jul 06, 2017 12:57 pm

Hello xeronar,

The version could indeed be a problem.
Please try to create a new project and see whether you are able to install the Jira package via the console.

regards,

qwertzu
Last edited by qwertzu on Tue Jul 11, 2017 1:47 pm, edited 1 time in total.

xeronar
Posts: 28
Joined: Mon May 22, 2017 8:19 pm

Re: Jira Integration: Initializer threw an exception

Post by xeronar » Mon Jul 10, 2017 11:02 am

Hi qwertzu,

this is the 4th brand new project I've created so far, after installing the JiraReporter and starting the tests I get the JSON error message every time. Maybe the structure of my test suite is weird, but I don't think so:

Code: Select all

TestSuite
   [SETUP]
      InitializeJiraReporter
   TestCase
      Recording
      [TEARDOWN]
         AutoCreateNewIssueIfTestCaseFails
   [TEARDOWN]
      Recording2
The installation of the package via console works as intended, but i got still those error messages.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Jira Integration: Initializer threw an exception

Post by Support Team » Thu Jul 13, 2017 12:37 pm

Hello everyone,

We are currently facing issues when adding the Ranorex Jira Reporter library to Ranorex 7.1.0.
The error message "Could not load file or assembly 'Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies." appears.

Until this issue will be fixed, we suggest the following workaround:


1. Please add the following assembly entry to your ”app.config” file:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>
2. Within the *.csproj file, you will have to fix the existing assembly reference.
Therefore, please remove the following xml code:

Code: Select all

<Reference Include="Newtonsoft.Json">
   <HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
Afterwards, please add the following xml snippet instead of the one above:

Code: Select all

<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference> 

Thank you for your understanding.

regards,
Stephan