Danfe procedure error! [-2146233036] The type initializer for '<Module>' threw an Exception

Asked

Viewed 26 times

0

Good afternoon guys, I have a system that performs the impression of Danfes in vb.net, but in a specific client he is making the following mistake:

Danfe procedure error! [-2146233036] The type initializer for '' threw an Exception

I took a close look at the code and got to the following function:

 Protected Overrides Sub ImprimeCabecalho()
   Dim empRz As System.String = Configuracoes4.Empresa.Razao
   Dim empCNPJ As System.String = Configuracoes4.Empresa.CNPJ
   Dim empIE As System.String = Configuracoes4.Empresa.Fisco.IE
   Dim empEndereco As System.String = Configuracoes4.Empresa.Contato.Endereco
   Dim empNumero As System.String = Configuracoes4.Empresa.Contato.Numero
   Dim empBairro As System.String = Configuracoes4.Empresa.Contato.Bairro
   Dim empCidade As System.String = Configuracoes4.Empresa.Contato.Cidade
   Dim empUF As System.String = Configuracoes4.Empresa.UF
   Dim empCEP As System.String = Configuracoes4.Empresa.Contato.CEP
   Dim empTelefone As System.String = Configuracoes4.Empresa.Contato.Telefone

   Dim str As String = ""

   If Not Me.FontesDefinidas Then
      Me.DefineFontes()
   End If

 'Cabeçalho principal
   str += empRz + vbLf
   str += "CNPJ:" & empCNPJ & " IE:" & empIE + vbLf
   str += empEndereco & ", " & empNumero & " " & empBairro & "-" & empCidade & "/" & empUF + vbLf
  str += "CEP:" & empCEP & " Tel:" & empTelefone

MsgBox("1")

  Me.ImprimeSpoolerCentro2(str)

  Me.ImprimeSpoolerCentro(RetornaLinha("-", False))
'Informativo NFCe
  str = "DANFE NFC-e - Documento Auxiliar da Nota Fiscal Eletrônica para Consumidor Final" & vbLf
  If Configuracoes4.Empresa.UF <> "PR" Then
      str += "Não permite aproveitamento de crédito de ICMS"
  End If
  Me.ImprimeSpoolerCentro(str, FonteOpcao.Destaque)
End Sub

In this function I have a msgbox that is fired before function Me.ImprimeSpoolerCentro2, that takes a string as parameter, debugging the project the string is formatted normally, below follows the function Printspatter:

Protected Sub ImprimeSpoolerCentro2(text As String)
    MsgBox("2")
    Me.ImprimeSpooler(text, , Nothing, Nothing, Windows.HorizontalAlignment.Center, )
    MsgBox("3")
End Sub

The error is triggered exactly when calling the function, not even showing Msgbox with "2".

Does anyone have any idea what it might be?

1 answer

0


The problem found here was that the . NET installed on my client’s machine, it was version 4.7 installed on an updated SP1 windows 7, I downloaded the version to 4.6 and it worked perfectly, but until I realized this had already passed 2 or 3 days. That’s it guys, I just wanted to share the resolution with everyone.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.