Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
Hello,

I have a problem and i don't know with witch tool i can trace it for debug.

My app work fine with an local Administrator account.

But with a limited user, the app crash when i run the Microsoft reportviewer report.


C#
public reportviewer(MainWindow window, SQLServerConnection connexion)
{
    this.connexion = connexion;
    this.window = window;
    InitializeComponent();
    _reportViewer.Load += _reportViewer_Load;
}
void _reportViewer_Load(object sender, EventArgs e)
{
    if (!_isReportViewerLoaded)
    {
            ReportDataSource reportDatasource1 = new ReportDataSource();
            dataset = new DB_DataSet();
            reportDatasource1.Name = "DB_DataSet";
            reportDatasource1.Value = dataset.general;
            this._reportViewer.LocalReport.DataSources.Add(reportDatasource1);
            SetReportParameters();

        List<string> ExportPath = new List<string>();
            ExportPath = window.ConfigParameters["ExportPDF_Path"].Split('\\').ToList();
            for (int index = 0; index < ExportPath.Count; index++)
            {
                if (ExportPath[index] == "")
                {
                    ExportPath.RemoveAt(index);
                }
            }
            foreach (string ElementPath in ExportPath)
            {
                if (ElementPath != ExportPath[0])
                {
                    Path_Export += @"/" + ElementPath;
                }
                else
                {
                    Path_Export = ExportPath[0];
                }
            }
        //Selecting output report
            switch (window.NomBouton)
            {
                case "Rapport normal":
                    this._reportViewer.LocalReport.ReportPath = "NormalReport.rdlc";
                    Path_Export += @"/" + PDFName + ".pdf";
                    NameAttachement = PDFName + ".pdf";
                    break;
                case "Rapport QSP":
                    this._reportViewer.LocalReport.ReportPath = "VendorName.rdlc";
                    Path_Export += @"/" + PDFName + "2" + ".pdf";
                    NameAttachement = PDFName + "2" + ".pdf"; ;
                    break;
                case "Rapport Bulletin sans nom":
                    this._reportViewer.LocalReport.ReportPath = "HidenNameReport.rdlc";
                    Path_Export += @"/" + PDFName + "HidenName" + ".pdf";
                    NameAttachement = PDFName + "HidenName" + ".pdf";
                    break;
            }
            _reportViewer.SetDisplayMode(DisplayMode.PrintLayout);
            this.Title = PDFName;
            _reportViewer.RefreshReport();
            SavePDF();

        if (window.ConfigParameters["AutoSend E-Mail"] == "True")
        {
            Mail = new Thread(new ThreadStart(SendMail));
            Mail.Start();

            while (Mail.IsAlive)
            {

            }
            Mail.Abort();
        }
        _isReportViewerLoaded = true;
    }


You saw something ?
Posted
Comments
Richard Deeming 15-Dec-15 12:54pm    
Are you trying to export to a path under the Program Files folder? Normal users don't have access to write files in that folder. You'll need to export to a different folder which the user does have access to.

If that's not the problem, then you'll need to click "Improve question" and post the full details of the exception.
IT_VBO 16-Dec-15 0:55am    
Hello,

It's not the pdf export. I verified the ntfs rights. i export to c:\temp (for example) and the application create successfully the folder and the user can write inside.

I saw the microsoft report create temp files inside

%currentuser%\appdata\Local\IsolatedStorage\irop1nw0.ckd\g2cvclbz.ovx\Publisher.hrvyd13ddpxak55x41ce0efyq30aahdz\AssemFiles

It's the .net framework crashing.

Version du Framework : v4.0.30319
Description : le processus a été arrêté en raison d'une exception non gérée.
Informations sur l'exception : System.InvalidOperationException
Pile :
à System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
à MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
à MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
à System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
à MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
à System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
à MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
à System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
à System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
à System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
à System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
à System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
à System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window)
à System.Windows.Forms.Application+ThreadContext.OnThreadException(System.Exception)
à System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)
à System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(Int32, System.String, System.String, Int32, Int32, Int32, Int32, Int32, System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, System.Object)
à System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(Int32, System.String, System.String, Int32, Int32, Int32, Int32, Int32, System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, System.Object)
à System.Windows.Forms.NativeWindow.CreateHandle(System.Windows.Forms.CreateParams)
à System.Windows.Forms.Control.CreateHandle()
à System.Windows.Forms.Control.get_Handle()
à System.Windows.Forms.Integration.WindowsFormsHost.BuildWindowCore(System.Runtime.InteropServices.HandleRef)
à System.Windows.Interop.HwndHost.BuildWindow(System.Runtime.InteropServices.HandleRef)
à System.Windows.Interop.HwndHost.BuildOrReparentWindow()
à System.Windows.Interop.HwndHost.OnSourceChanged(System.Object, System.Windows.SourceChangedEventArgs)
à System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
à System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
à System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
à System.Windows.PresentationSource.UpdateSourceOfElement(System.Windows.DependencyObject, System.Windows.DependencyObject, System.Windows.DependencyObject)
à System.Windows.Media.Visual.ProcessAncestorChangedNotificationRecursive(System.Windows.DependencyObject, System.Windows.Media.AncestorChangedEventArgs)
à System.Windows.Media.Visual.ProcessAncestorChangedNotificationRecursive(System.Windows.DependencyObject, System.Windows.Media.AncestorChangedEventArgs)
à System.Windows.Controls.ContentPresenter+UseContentTemplate.BuildVisualTree(System.Windows.Fra
IT_VBO 16-Dec-15 0:56am    
System.Windows.Controls.ContentPresenter+UseContentTemplate.BuildVisualTree(System.Windows.FrameworkElement)
à System.Windows.StyleHelper.ApplyTemplateContent(System.Windows.UncommonField`1<system.collections.specialized.hybriddictionary[]>, System.Windows.DependencyObject, System.Windows.FrameworkElementFactory, Int32, System.Collections.Specialized.HybridDictionary, System.Windows.FrameworkTemplate)
à System.Windows.FrameworkTemplate.ApplyTemplateContent(System.Windows.UncommonField`1<system.collections.specialized.hybriddictionary[]>, System.Windows.FrameworkElement)
à System.Windows.FrameworkElement.ApplyTemplate()
à System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
à System.Windows.UIElement.Measure(System.Windows.Size)
à System.Windows.Documents.AdornerDecorator.MeasureOverride(System.Windows.Size)
à System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
à System.Windows.UIElement.Measure(System.Windows.Size)
à System.Windows.Controls.Border.MeasureOverride(System.Windows.Size)
à System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
à System.Windows.UIElement.Measure(System.Windows.Size)
à System.Windows.Window.MeasureOverrideHelper(System.Windows.Size)
à System.Windows.Window.MeasureOverride(System.Windows.Size)
à System.Windows.FrameworkElement.MeasureCore(System.Windows.Size)
à System.Windows.UIElement.Measure(System.Windows.Size)
à System.Windows.Interop.HwndSource.SetLayoutSize()
à System.Windows.Interop.HwndSource.set_RootVisualInternal(System.Windows.Media.Visual)
à System.Windows.Window.SetRootVisualAndUpdateSTC()
à System.Windows.Window.SetupInitialState(Double, Double, Double, Double)
à System.Windows.Window.CreateSourceWindow(Boolean)
à System.Windows.Window.ShowHelper(System.Object)
à OldSAVForm.MainWindow.btn_RapportNormal_Click(System.Object, System.Windows.RoutedEventArgs)
à System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
à System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
à System.Windows.Controls.Button.OnClick()
à System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs)
à System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
à System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
à System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject, System.Windows.RoutedEventArgs, System.Windows.RoutedEvent)
à System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
à System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
à System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
à System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
à System.Windows.Input.InputManager.ProcessStagingArea()
à System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)
à System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawMouseActions, Int32, Int32, Int32)
à System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef)
à System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
à MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
à MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
à System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
à MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
à System.Windows.Threading.Dispatcher.Lega
IT_VBO 16-Dec-15 0:57am    
à System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
à MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
à MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
à MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
à System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
à System.Windows.Application.RunInternal(System.Windows.Window)
à System.Windows.Application.Run()



Big Crash.... Is like having a thread problem... or background worker.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900