Completed
Last Updated: 09 Sep 2016 14:42 by Alex Dybenko
Alex Dybenko
Created on: 22 Aug 2016 08:26
Category: UI Framework
Type: Bug Report
1
FIX. Print preview dialog buttons are not shown after ILMerge
After ILMerge buttons on printpreview dialog are not painted. Run attached InfoCubeM.exe (merged InfoCube.exe), press radbutton, buttons appears as on attached capture. InfoCube.ilproj and ILMerge-cmd.txt also in attached zip
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
7 comments
Alex Dybenko
Posted on: 29 Aug 2016 10:56
Hi Hristo,
Thanks, works fine at my end as well!

Alex
ADMIN
Hristo
Posted on: 26 Aug 2016 13:19
Hi Alex, 

The reported secondary issue is not related to the icons problem we initially isolated. The exception appears to be caused by an incorrect ILMerge command and the .NET Framework itself.  When you upgrade the .NET Framework on your build machine, the machine on which you are performing the ILMerge operation, the assemblies in this directory /targetplatform:"v4,c:\windows\Microsoft.NET\Framework\v4.0.30319" are actually also updated. Please refer to the following forum thread for a more detailed answer: http://stackoverflow.com/a/13750130

You can workaround it by changing  your /targetplatform attribute this way: /targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0". I tested ILMerging your application with the updated command and there was no error running the executable on Windows 7 having only .NET 4.0.

I hope this helps. 
Hristo

Alex Dybenko
Posted on: 24 Aug 2016 07:46
correction for above:
"merged and got this exeption (only on win7 with .NET4.0):"

BTW, "Edit" functionality is not working for message above
Alex Dybenko
Posted on: 24 Aug 2016 07:44
Hi Stefan,
yes, I have Target Framework = .NET4.0

Perhaps it is also related to icons problem? For example, i just tried to make a new project, added some DLL, merged, works ok, then added Telerik DLLs, PivotGrid on form, merged, works ok, then added code to button click event:

 Me.RadPivotGrid1.PrintPreview()

merged and got this exeption (only on win7 with .NET4):

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
   at System.ModuleHandle.ResolveMethod(RuntimeModule module, Int32 methodToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount)
   at System.ModuleHandle.ResolveMethodHandleInternalCore(RuntimeModule module, Int32 methodToken, IntPtr[] typeInstantiationContext, Int32 typeInstCount, IntPtr[] methodInstantiationContext, Int32 methodInstCount)
   at System.ModuleHandle.ResolveMethodHandleInternal(RuntimeModule module, Int32 methodToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.Reflection.CustomAttributeData..ctor(RuntimeModule scope, CustomAttributeRecord caRecord)
   at System.Reflection.CustomAttributeData.GetCustomAttributes(RuntimeModule module, Int32 tkTarget)
   at System.Reflection.CustomAttributeData.GetCustomAttributesInternal(RuntimeAssembly target)
   at System.Reflection.RuntimeAssembly.GetCustomAttributesData()
   at System.Reflection.CustomAttributeData.GetCustomAttributes(Assembly target)
   at System.Resources.ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(Assembly a, UltimateResourceFallbackLocation& fallbackLocation)
   at System.Resources.ResourceManager.CommonSatelliteAssemblyInit()
   at System.Resources.ResourceManager..ctor(Type resourceSource)
   at System.ComponentModel.ComponentResourceManager..ctor(Type t)
   at Telerik.WinControls.UI.RadPrintPreviewDialog.InitializeComponent()
   at Telerik.WinControls.UI.RadPrintPreviewDialog..ctor()
   at Telerik.WinControls.UI.RadPrintPreviewDialog..ctor(RadPrintDocument document)
   at Telerik.WinControls.UI.RadPivotGrid.PrintPreview(RadPrintDocument document)
   at Telerik.WinControls.UI.RadPivotGrid.PrintPreview()
   at TestNet40.Form1.Button1_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
TestNet40M
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///Z:/E/Projects/firstPOS/Cube/TestNet40/bin/Debug/TestNet40M.exe
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Runtime.Remoting
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
bfys3u41
    Assembly Version: 1.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.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.


ADMIN
Stefan
Posted on: 24 Aug 2016 06:46
Hi Alex, 

I don't think this has anything to do with Telerik controls and you will observe the same behavior with a simple app not containing our controls.

If you build an app for 4.6 and then try to run it on a machine without 4.6, it is expected to see the crash. To solve it, just make sure to set the project Target Framework to .NET4.0, when building it despite the fact you have 4.6 installed, so it can be run on machines with 4.0 and above. 

More information on .net framework compatibility can be found here: https://msdn.microsoft.com/en-us/library/ff602939(v=vs.110).aspx
Alex Dybenko
Posted on: 24 Aug 2016 06:23
Hi Hristo,
Thanks for fix, works ok. 
Noted about assemblies...

One more problem with  ILMerge process, you can try it also on my test project:
If I run InfoCubeM.exe (ILMerged on .NET 4.6 PC) on windows 7 or Server 2003 with .NET 4.0 installed (the only option for Server 2003) - it crashes. But, if I do ILMerge on .NET 4.0 installed PC - then it works on 4.0 and later versions. It is expected behavior or possible to avoid crash? As I understand - min requirement for Telerik controls is .NET 4.0
Regards,
Alex

ADMIN
Hristo
Posted on: 23 Aug 2016 12:43
Hi Alex,

Thank you for submitting this item.

Indeed there is an issue with the icons in the command bar of RadPrintPreviewDialog when performing ILMerge. Until we resolve it please create a custom RadPrintPreviewDialog and set the images locally. I am attaching a project demonstrating the suggested approach.

On a side note, your test project has been moved to the private part of the portal because it contained our assemblies which should not be exposed publicly. In the future please avoid that.

Regards,
Hristo