Reportviewer - Methodaccessexception

Asked

Viewed 61 times

0

Good afternoon,

I use Visualstudio 2015 Community on a Windows 10 x64 and am encountering the following problem when running the debug of a Windows Form Application project:

    System.MethodAccessException was unhandled
  HResult=-2146233072
  Message=Falha no método 'Microsoft.Reporting.WinForms.LocalReport..ctor()' ao tentar acessar o método 'Microsoft.ReportingServices.StandalonePreviewStore..ctor()'.
  Source=Sistema
  StackTrace:
       em Microsoft.Reporting.WinForms.LocalReport..ctor() na C:\Projetos\VisualStudio\Sistema\Sistema\Beans\GuiaSadt.cs:linha 0
       em Microsoft.Reporting.WinForms.ReportViewer.CreateLocalReport() na C:\Projetos\VisualStudio\Sistema\Sistema\Beans\GuiaSadt.cs:linha 0
       em Microsoft.Reporting.WinForms.ReportViewer.Reset() na C:\Projetos\VisualStudio\Sistema\Sistema\Beans\GuiaSadt.cs:linha 0
       em Microsoft.Reporting.WinForms.ReportViewer..ctor() na C:\Projetos\VisualStudio\Sistema\Sistema\Beans\GuiaSadt.cs:linha 0
       em Sistema.FrmPrincipal.FrmPrincipal_Load(Object sender, EventArgs e) na C:\Projetos\VisualStudio\Sistema\Sistema\FrmPrincipal.cs:linha 181
       em System.Windows.Forms.Form.OnLoad(EventArgs e)
       em System.Windows.Forms.Form.OnCreateControl()
       em System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       em System.Windows.Forms.Control.CreateControl()
       em System.Windows.Forms.Control.WmShowWindow(Message& m)
       em System.Windows.Forms.Control.WndProc(Message& m)
       em System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       em System.Windows.Forms.Form.WmShowWindow(Message& m)
       em System.Windows.Forms.Form.WndProc(Message& m)
       em System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       em System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       em System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  InnerException: 

I am using Control Reportviewer inside a Form with nothing else in it and this error happens.

Is there any reference or configuration missing in my project? Grateful.

EDIT: Where the error occurs is the following excerpt:

this.reportViewer1 = new Microsoft.Reporting.WinForms.ReportViewer();
  • Has more information of the error?

  • @Unfortunately not denercarvalho, that’s all that appears in the detail panel of the exception, there is some other information that I can put here or an image.. thanks for the help

  • What is the method of reportviewer q this given error?

  • @Denercarvalho I edited the question with the passage that launches the Exception

  • You are initiating the object in the load event?

  • This this.reportViewer1 = new Microsoft.Reporting.WinForms.ReportViewer(); is the content of line 181?

  • @Denercarvalho When I drag the control pro form, the code is automatically created in the form Load event this.reportViewer1.RefreshReport(); which is line 181 already the new ReportViewer() is chado from the InitializeComponents() form builder

Show 2 more comments

1 answer

0


The problem that was occurring was with Ilmerge.

Since Ilmerge merged with . exe the DLL’s used by the project Reportviewer did not find the reference causing the error.

Removing Ilmerge from the project everything works again.

Browser other questions tagged

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