Current filter:
                                You should refresh the page.
                                  • Hello,

                                    I want to do a refactoring on aConnection using a using statement, but i don't have the choice, to do this.
                                    Here is the code and please see the attachments: CR is Classic CodeRush, CRR is CodeRush for Roslyn

                                    [C#]
                                    /// <summary> /// lesen eines Datensatzes aus der lokalen Datenbank /// </summary> /// <returns>Dataset mit der geforderten ID</returns> public DsPcWrkAufP1 ReadFromLocal(decimal idWerkauftrag) { var aDataSet = new DsPcWrkAufP1(); var aConnection = PCCommon.Instance.ConnectionMySql; var aCommand = aConnection.CreateCommand(); aCommand.CommandText = String.Format(SQL.selectAuftrag, idWerkauftrag); try { aConnection.Open(); using (var aReader = aCommand.ExecuteReader()) { aDataSet.PCWRKAUFP1.Load(aReader); } } catch (Exception ex) { var st = new StackTrace(); var sf = st.GetFrame(0); var MethodName = sf.GetMethod().Name; var ClassName = sf.GetMethod().DeclaringType.Name; var aMessage = String.Format("{0} ({1}) -> {2}", MethodName, ClassName, ex.Message); LogMe.Instance.LogIt(aMessage); try { var eMail = new MailMessage(); var mailSender = new MailAddress(string.Format("{0}@paulundco.de", PCCommon.Instance.Kostenstelle), string.Format("Kostenstelle {0}", PCCommon.Instance.Kostenstelle)); eMail.From = mailSender; eMail.To.Add(PCCommon.Instance.ErrorMailReceiver); eMail.Subject = string.Format("{0} -> Hostname: {1}", Resources.ErrorMailSubject.Trim(), System.Net.Dns.GetHostName()); eMail.Body = aMessage; var mailClient = new SmtpClient(PCCommon.Instance.MailServer); mailClient.Send(eMail); } catch { } } finally { aConnection.Close(); } return aDataSet;

                                    Thank you
                                    Hans-Peter

                                Show all comments
                                • Dmitry O (DevExpress) 07.10.2017

                                  Hi Hans-Peter,

                                  I have reproduced the problem on my side with this code snippet:

                                  [C#]
                                  using System.IO; public class PCCommon { public PCCommon() { } public static PCCommon Instance { get; set; } public FileStream ConnectionMySql { get; } } public class MyClass { public void DrawEllipses() { var aConnection = PCCommon.Instance.ConnectionMySql; } }

                                  We will try to fix it as soon as possible. Once we make any progress, we will let you know.
                                  Note: you can learn more about the Introduce Using Statement feature for CodeRush for Roslyn at Introduce Using Statement.

                                • Dmitry O (DevExpress) 07.12.2017

                                  Hans-Peter, we tried to fix the issue and prepared a special build for you with the fix.
                                  Would you please install the build, try to reproduce the issue, and provide us with your results?

                                  I look forward to your reply.

                                • Hans-Peter Sannert 07.12.2017

                                  Hello Dmitry,

                                  problem fixed.

                                  Thank you
                                  Hans-Peter

                                • Dmitry O (DevExpress) 07.13.2017

                                  You are welcome.

                                • Dmitry O (DevExpress) 07.13.2017

                                  Hans-Peter, I have noticed that this ticket is marked as "Private" and thus it is invisible to others. If you do not mind, I would like to make it public so that other customers can view it and track our progress with this issue. If you want me to remove private information from this ticket prior to publishing it, please let me know.

                                • Hans-Peter Sannert 07.13.2017

                                  you can remove the private flag

                                • Dmitry O (DevExpress) 07.14.2017

                                  Thank you for your cooperation.

                                1 Solution

                                Creation Date Importance Sort by

                                Fixed: