Windows 10 error - System.ComponentModel.Win32Exception (0x80004005)



  • Hello, I've build a simple winforms app but I'm getting this error when the app is deployed to other Windows 10 machines (both VMs and real laptops):

    System.ComponentModel.Win32Exception (0x80004005)
    ...
    System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
    jsreport.Local.Internal.BinaryProcess.<InnerExecute>d__18.MoveNext()mark
    ...
    

    The app works fine on Windows 7 maquines and locally (I'm running Windows 10 x64 to code).

    I've created x86/x64 versions using NET Framework 4.5.2 and 4.6.1 but none of those builds work on Windows 10.

    Here's my code:

    using jsreport.Binary;
    using jsreport.Local;
    using jsreport.Types;
    using System;
    using System.IO;
    using System.Windows.Forms;
    
    namespace WindowsFormsApp1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private async void button1_Click(object sender, EventArgs e)
            {
                var rs = new LocalReporting().UseBinary(JsReportBinary.GetBinary()).AsUtility().Create();
    
                var report = await rs.RenderAsync(new RenderRequest()
                {
                    Template = new Template()
                    {
                        Recipe = Recipe.PhantomPdf,
                        Engine = Engine.None,
                        Content = "Hello from pdf"
                    }
                });
    
                using (var fs = File.Create("out.pdf"))
                {
                    report.Content.CopyTo(fs);
                }
            }
        }
    }
    


  • The same code works for me on Win 10 x64.
    Could you please try to download and run manually the jsreport binary from console on the target machine? Try to render something with --keepAlive. It could give us some better error showing what is wrong.

    https://jsreport.net/learn/single-file-executable



  • Here's the cmd output:

    C:\Users\Username\Desktop>jsreport render --template.engine=none --template.recipe=phantom-pdf --template.content=test.html --out=out.pdf --keepAlive
    instance has been daemonized and initialized successfully (pid: 3948)
    rendering has finished with errors:
    An error occurred while trying to execute the command:
    { [Error: getaddrinfo ENOENT localhost:49670]
      code: 'ENOENT',
      errno: 'ENOENT',
      syscall: 'getaddrinfo',
      hostname: 'localhost',
      host: 'localhost',
      port: '49670' }
    


  • Thank you. That helps a lot.
    It seems that the machine cannot bind to the localhost network address. Doesn't the target machine include localhost in the hosts file?



  • New Win10x64 VM, same error:

    See the end of this message for details on invoking 
    just-in-time (JIT) debugging instead of this dialog box.
    
    ************** Exception Text **************
    System.ComponentModel.Win32Exception (0x80004005): The specified executable is not a valid application for this OS platform.
       at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
       at System.Diagnostics.Process.Start()
       at jsreport.Local.Internal.BinaryProcess.<InnerExecute>d__18.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
       at jsreport.Local.Internal.BinaryProcess.<ExecuteExe>d__17.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
       at jsreport.Local.Internal.LocalUtilityReportingService.<RenderAsync>d__10.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at WindowsFormsReport.Form1.<button1_ClickAsync>d__1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0(Object state)
    
    
    ************** Loaded Assemblies **************
    mscorlib
        Assembly Version: 4.0.0.0
        Win32 Version: 4.6.1586.0 built by: NETFXREL2
        CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
    ----------------------------------------
    WindowsFormsReport
        Assembly Version: 1.0.0.0
        Win32 Version: 1.0.0.0
        CodeBase: file:///C:/Users/Lab/AppData/Local/Apps/2.0/8HXGOOLD.05Z/0LE8B4RQ.CCO/wind..tion_ef3ecbf0849a8908_0001.0000_dd76a3a7cdfc02bc/WindowsFormsReport.exe
    ----------------------------------------
    System.Windows.Forms
        Assembly Version: 4.0.0.0
        Win32 Version: 4.6.1586.0 built by: NETFXREL2
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    ----------------------------------------
    System
        Assembly Version: 4.0.0.0
        Win32 Version: 4.6.1586.0 built by: NETFXREL2
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    System.Drawing
        Assembly Version: 4.0.0.0
        Win32 Version: 4.6.1586.0 built by: NETFXREL2
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    Accessibility
        Assembly Version: 4.0.0.0
        Win32 Version: 4.6.1586.0 built by: NETFXREL2
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
    ----------------------------------------
    jsreport.Types
        Assembly Version: 1.8.3.0
        Win32 Version: 1.8.3.0
        CodeBase: file:///C:/Users/Lab/AppData/Local/Apps/2.0/8HXGOOLD.05Z/0LE8B4RQ.CCO/wind..tion_ef3ecbf0849a8908_0001.0000_dd76a3a7cdfc02bc/jsreport.Types.DLL
    ----------------------------------------
    jsreport.Local
        Assembly Version: 1.0.2.0
        Win32 Version: 1.0.2.0
        CodeBase: file:///C:/Users/Lab/AppData/Local/Apps/2.0/8HXGOOLD.05Z/0LE8B4RQ.CCO/wind..tion_ef3ecbf0849a8908_0001.0000_dd76a3a7cdfc02bc/jsreport.Local.DLL
    ----------------------------------------
    jsreport.Binary
        Assembly Version: 1.8.2.0
        Win32 Version: 1.8.2.0
        CodeBase: file:///C:/Users/Lab/AppData/Local/Apps/2.0/8HXGOOLD.05Z/0LE8B4RQ.CCO/wind..tion_ef3ecbf0849a8908_0001.0000_dd76a3a7cdfc02bc/jsreport.Binary.DLL
    ----------------------------------------
    jsreport.Shared
        Assembly Version: 1.0.1.0
        Win32 Version: 1.0.1.0
        CodeBase: file:///C:/Users/Lab/AppData/Local/Apps/2.0/8HXGOOLD.05Z/0LE8B4RQ.CCO/wind..tion_ef3ecbf0849a8908_0001.0000_dd76a3a7cdfc02bc/jsreport.Shared.DLL
    ----------------------------------------
    Newtonsoft.Json
        Assembly Version: 10.0.0.0
        Win32 Version: 10.0.3.21018
        CodeBase: file:///C:/Users/Lab/AppData/Local/Apps/2.0/8HXGOOLD.05Z/0LE8B4RQ.CCO/wind..tion_ef3ecbf0849a8908_0001.0000_dd76a3a7cdfc02bc/Newtonsoft.Json.DLL
    ----------------------------------------
    System.Core
        Assembly Version: 4.0.0.0
        Win32 Version: 4.6.1586.0 built by: NETFXREL2
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
    ----------------------------------------
    System.Numerics
        Assembly Version: 4.0.0.0
        Win32 Version: 4.6.1586.0 built by: NETFXREL2
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
    ----------------------------------------
    System.Runtime.Serialization
        Assembly Version: 4.0.0.0
        Win32 Version: 4.6.1586.0 built by: NETFXREL2
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
    ----------------------------------------
    System.Data
        Assembly Version: 4.0.0.0
        Win32 Version: 4.6.1586.0 built by: NETFXREL2
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
    ----------------------------------------
    System.Xml
        Assembly Version: 4.0.0.0
        Win32 Version: 4.6.1586.0 built by: NETFXREL2
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
    ----------------------------------------
    System.Runtime.InteropServices.RuntimeInformation
        Assembly Version: 4.0.1.0
        Win32 Version: 4.6.24705.01
        CodeBase: file:///C:/Users/Lab/AppData/Local/Apps/2.0/8HXGOOLD.05Z/0LE8B4RQ.CCO/wind..tion_ef3ecbf0849a8908_0001.0000_dd76a3a7cdfc02bc/System.Runtime.InteropServices.RuntimeInformation.DLL
    ----------------------------------------
    System.Runtime
        Assembly Version: 4.0.0.0
        Win32 Version: 4.6.1586.0
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Runtime.dll
    ----------------------------------------
    
    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled.
    
    For example:
    
    <configuration>
        <system.windows.forms jitDebugging="true" />
    </configuration>
    
    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.
    

    Host file content:

    # Copyright (c) 1993-2009 Microsoft Corp.
    #
    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
    #
    # This file contains the mappings of IP addresses to host names. Each
    # entry should be kept on an individual line. The IP address should
    # be placed in the first column followed by the corresponding host name.
    # The IP address and the host name should be separated by at least one
    # space.
    #
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    #
    # For example:
    #
    #      102.54.94.97     rhino.acme.com          # source server
    #       38.25.63.10     x.acme.com              # x client host
    
    # localhost name resolution is handled within DNS itself.
    #	127.0.0.1       localhost
    #	::1             localhost
    


  • This is different error

    System.ComponentModel.Win32Exception (0x80004005): The specified executable is not a valid application for this OS platform.
    

    I've seen such message always when running on x32 windows. You are sure you have x64 right?
    However the problem can be of course something else.



  • Finally figured out what was missing. WinForms and WPF deployments need Visual C++ 2015 Redistributable (both x86/x64) to be installed on Windows 10 before calling jsreport.

    Not sure about why Windows 7 runs the app without problems and Windows 10 fails but in my case after installing vsredist everything works as expected.

    FYI there are 4 versions of Visual C++ 2015 Redistributable (we only need one of those):

    Visual C++ 2015 Redistributable
    Visual C++ 2015 Redistributable Update 3
    Visual C++ Redistributable for Visual Studio 2015
    Visual C++ Redistributable for Visual Studio 2015 Update 1

    Cheers.



  • Thank you for sharing it. Will keep that in mind.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.