Bug 39176 - C# .NET 4.5 | System.InvalidProgramException: Invalid IL code
Summary: C# .NET 4.5 | System.InvalidProgramException: Invalid IL code
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-02-27 00:21 UTC by KorencSoft
Modified: 2018-01-24 16:27 UTC (History)
5 users (show)

Tags: c#, .NET45, Ubuntu
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description KorencSoft 2016-02-27 00:21:15 UTC
I was updating mono from repository to a github version. I wrote an NancyFx self-hosted console application in C# .NET 4.5. I am running Ubuntu server 14.04 LTS x64. I bumped in this error and I am not sure if this is 

System.InvalidProgramException: Invalid IL code 


System.Security.Cryptography.Xml.SignedXml:.ctor (System.Xml.XmlDocument): method body is empty.

This is full error stack: http://pastebin.com/MJfp3VsV

also this is an invoice, but echo works just fine and it's using the same code. On windows it's working just fine. This server is written for Fiscal Verification of Invoices. Invoice is used for verification of invoice and echo it's just used for testing if server is online. All XAML soap requests must be signed with certificate which was provided by Slovenian Government.

For more info just comment or visit: http://www.datoteke.fu.gov.si/dpr/index_en.html


Invoice XML scheme: pastebin.com/P9bYWvhu

Echo XML scheme: pastebin.com/XTPWAhJR

***StackOverflow question: http://stackoverflow.com/questions/35663804/error-after-mono-upgrade
Comment 1 KorencSoft 2016-02-27 00:23:21 UTC
Mono version:

root@node2:~/servers/blagajna# mono --version
Mono JIT compiler version 4.5.0 (master/cde5626 Fri Feb 26 17:18:54 EST 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen
Comment 2 Marek Safar 2016-02-27 00:31:55 UTC
It looks like you are running it using api profile not actual runtime profile from mono/lib/4.5 but I don't know how NancyFX calls mono.
Comment 3 KorencSoft 2016-02-27 00:46:54 UTC
Few weeks back worked perfectly, but now not anymore.
Comment 4 KorencSoft 2016-02-27 00:59:50 UTC
You can download my project here, but it's mission passwords, certificats...
Comment 5 Marek Safar 2016-02-29 13:56:34 UTC
It errors out with 410: Files limited!
Comment 6 KorencSoft 2016-02-29 14:27:48 UTC
I've removed the limit, files are now accessible.
Comment 7 Marek Safar 2016-02-29 15:44:59 UTC
Still cannot reproduce it. Could run mono with MONO_LOG_LEVEL=debug and attach the output?

When I run it locally I get

***Starting WEB DPR API - Korenc Soft
***Davčno potrjevanje računov
***Na : http://localhost:8810


curl http://localhost:8810/Racun

Comment 8 KorencSoft 2016-02-29 16:04:40 UTC
Sorry I should be more specific. XML files available here: https://ksoft.xyz/downloads/bugreports/39176/xml-temp.zip
must be placed in /home/rsl/xml/
If you want to get the ECHO you need to send POST to address:port/Racun/Echo, with variable 'msg'. But that works and outputs this: 
  "soapenv:Envelope": {
    "@xmlns:soapenv": "http://schemas.xmlsoap.org/soap/envelope/",
    "@xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
    "@xmlns:fu": "http://www.fu.gov.si/",
    "@xmlns:ds": "http://www.w3.org/2000/09/xmldsig#",
    "@xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
    "soapenv:Body": {
      "fu:EchoResponse": "ThisIsATest 2016-02-29T16:56:14"
for invoicing there is adress:port/Racun/Potrdi with variables:
Cena, which means price with format x.xx
UserTaxNum, which is 56853076
Izdajatelj, which is KORENC or RSL

The only problem is that access to Government servers are limited to Slovenia, if you want I can set up you with ssh access.

Output of address:port/Racun/Potrdi should be:
  "eor": "5ff41c46-2761-4ee4-8052-39a8a21a350c",
  "zoi": "6baf6ab3b138e065a4e855bbfc60b04a",
  "datum": "29.02.2016 17:01:40",
  "kid": "U1JWLUJSU0wtMjMtMC4xMA==",
  "qr": "WIP"
Comment 9 KorencSoft 2016-02-29 16:15:02 UTC
Also I've sent you and email with MySQL connection string.
Comment 10 Marek Safar 2016-02-29 17:07:32 UTC
This works for me. I get following response to post to Racun/Echo

  "soapenv:Envelope": {
    "@xmlns:soapenv": "http://schemas.xmlsoap.org/soap/envelope/",
    "@xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
    "@xmlns:fu": "http://www.fu.gov.si/",
    "@xmlns:ds": "http://www.w3.org/2000/09/xmldsig#",
    "@xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
    "soapenv:Body": {
      "fu:EchoResponse": "2016-02-29T18:03:01"
Comment 11 KorencSoft 2016-02-29 18:20:53 UTC
Sorry but I guess you missed what i wrote. ECHO works fine and this is correct, but verification (address:port/Racun/Potrdi) throws this error. To replicate steps here:
1. address:port/Racun/Potrdi
2. set variables
      Cena: 0.10
      UserTaxNum: 56853076
      Izdajatelj: KORENC
3. Send POST

Correct answer from server is:
  "eor": "5ff41c46-2761-4ee4-8052-39a8a21a350c",
  "zoi": "6baf6ab3b138e065a4e855bbfc60b04a",
  "datum": "29.02.2016 17:01:40",
  "kid": "U1JWLUJSU0wtMjMtMC4xMA==",
  "qr": "WIP"
and server should output the same ZOI code, but in my case just outputs an error.
Comment 13 Marek Safar 2017-09-06 14:49:51 UTC
Please provide further information how to reproduce the issue
Comment 14 Ludovic Henry 2018-01-24 16:27:52 UTC
Please provide a reproduction case if you can still reproduce to reopen. Thank you.