private void aftermost() { try { ICLRRuntimeInfo rtInfo = (ICLRRuntimeInfo)RuntimeEnvironment.GetRuntimeInterfaceAsObject(Guid.Empty, typeof(ICLRRuntimeInfo).GUID); rtInfo.BindAsLegacyV2Runtime(); string path = Directory.GetCurrentDirectory(); var a = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); ReportDocument report = new ReportDocument(); report.Load(a + @"/CrystalReport4.rpt"); CustomerLedgerDataSet ds = new CustomerLedgerDataSet(); DataTable dt1 = ds.BillProduct; DataTable dt2 = ds.Customer; foreach (var item in customer.CustomerCollection) { dt2.Rows.Add(item.Customerid, item.CustomerName, item.CustomerLocation, item.Customerbalance, item.CustomerLastTally, item.Customerphone); } report.SetDataSource(ds); crystalReportsViewer2.ViewerCore.ReportSource = report; } catch (Exception e1) { Debug.WriteLine(e1.Message); } }
private static ICorDebug CreateDebugger(ICLRRuntimeInfo runtime) { Object res; runtime.GetInterface(ref codebugger_clsid, ref codebugger_riid, out res); return((ICorDebug)res); }
public App() { #if RELEASE if (!ApplicationDeployment.IsNetworkDeployed) { // this application was started up from the exe that isnt good. // restart application through clickonce. string clickOnceApplication = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu) + "\\Programs\\Bend\\Bend\\Bend.appref-ms"; string[] commandLineArgs = Environment.GetCommandLineArgs(); string argument; if (commandLineArgs.Length > 1) { if (System.IO.Path.IsPathRooted(commandLineArgs[1])) { argument = commandLineArgs[1]; } else { argument = Environment.CurrentDirectory + "\\" + commandLineArgs[1]; } } else { argument = ""; } System.Diagnostics.Process.Start(clickOnceApplication, argument); this.Shutdown(); } #endif ICLRRuntimeInfo runtimeInfo = (ICLRRuntimeInfo)RuntimeEnvironment.GetRuntimeInterfaceAsObject(Guid.Empty, typeof(ICLRRuntimeInfo).GUID); runtimeInfo.BindAsLegacyV2Runtime(); }
// creates ICorDebug instance from ICLRRuntimeInfo private static CorDebugger CreateDebugger(ICLRRuntimeInfo runtime, CorDebuggerOptions options) { Object res; runtime.GetInterface(ref CLSID_ICorDebug, ref IID_ICorDebug, out res); return(new CorDebugger((ICorDebug)res, options)); }
public static void UseLegacy() { ICLRRuntimeInfo clrRuntimeInfo = (ICLRRuntimeInfo)RuntimeEnvironment.GetRuntimeInterfaceAsObject( Guid.Empty, typeof(ICLRRuntimeInfo).GUID); clrRuntimeInfo.BindAsLegacyV2Runtime(); }
private DebugContext(ICLRRuntimeInfo runtime) { var debuggingClassId = Constants.ClrDebuggingLegacyGuid; var debugInterfaceId = typeof(ICorDebug).GUID; this.debug = (ICorDebug)runtime.GetInterface(ref debuggingClassId, ref debugInterfaceId); this.debug.Initialize(); this.debug.SetManagedHandler(this); }
static void TryGetRuntimePolicy(ICLRRuntimeInfo clrRuntimeInfo) { try { clrRuntimeInfo.BindAsLegacyV2Runtime(); LegacyV2RuntimeEnabledSuccessfully = true; } catch (COMException) { // This occurs with an HRESULT meaning // "A different runtime was already bound to the legacy CLR version 2 activation policy." LegacyV2RuntimeEnabledSuccessfully = false; } }
static void TryGetRuntimePolicy(ICLRRuntimeInfo clrRuntimeInfo) { try { clrRuntimeInfo.BindAsLegacyV2Runtime(); LegacyV2RuntimeEnabledSuccessfully = true; } catch (COMException) { // This occurs with an HRESULT meaning // "A different runtime was already bound to the legacy CLR version 2 activation policy." LegacyV2RuntimeEnabledSuccessfully = false; } }
/// <summary> /// Creates new process under the debugger. /// </summary> /// <param name="exepath">executable path</param> /// <param name="desiredVersion">the desired version of the runtime - you don't need to /// provide the whole version string as only the first n letters /// are compared, for example version string: "v2.0" will match /// runtimes versioned "v2.0.1234" or "v2.0.50727". If <code>null</code> /// is given, the first found runtime will be returned.</param> /// <param name="options">The options.</param> /// <returns></returns> public static CorDebugger CreateDebuggerForExecutable(String exepath, String desiredVersion = null, CorDebuggerOptions options = null) { ICLRMetaHost metahost = NativeMethods.CLRCreateInstance(ref CLSID_ICLRMetahost, ref IID_ICLRMetahost); IEnumUnknown runtimes = metahost.EnumerateInstalledRuntimes(); ICLRRuntimeInfo runtime = GetRuntime(runtimes, desiredVersion); if (runtime == null) { throw new RuntimeNotFoundException(); } return(CreateDebugger(runtime, options ?? new CorDebuggerOptions())); }
private void POS_Product() { webHandler.POS_Get_ProductAsync(); webHandler.POS_Get_ProductCompleted += (x, y) => { var result = y.Result; product.ProductsCollection = new ObservableCollection <ProductsModel>(); string[] arr = result.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); foreach (var item in arr) { string[] arg = item.Split(new string[] { "---" }, StringSplitOptions.None); product.ProductsCollection.Add(new ProductsModel() { Productid = arg[0], ProductName = arg[1], ProductCatagoryid = arg[2], ProductCatagoryDesc = arg[3], ProductPrice = arg[4], ProductStatusid = arg[5], ProductStatusDesc = arg[6], ProductQuantity = arg[7], ProductDesc = arg[8], ProductBuyingPrice = arg[9], ProductProfit = arg[10], }); } try { ICLRRuntimeInfo rtInfo = (ICLRRuntimeInfo)RuntimeEnvironment.GetRuntimeInterfaceAsObject(Guid.Empty, typeof(ICLRRuntimeInfo).GUID); rtInfo.BindAsLegacyV2Runtime(); report.Load("../../CrystalReport1.rpt"); report.SetDataSource(from c in product.ProductsCollection select new { c.Productid, c.ProductName, c.ProductCatagoryDesc, c.ProductPrice, c.ProductStatusDesc, c.ProductBuyingPrice, c.ProductQuantity }); crystalReportsViewer1.ViewerCore.ReportSource = report; } catch (Exception e1) { Debug.WriteLine("Kush hua hai "); Debug.WriteLine(e1.Message); } //ReportDocument report2 = new ReportDocument(); //report2.Load("../../CrystalReport2.rpt"); //report2.SetDataSource(from c in product.ProductsCollection // select new { c.Productid, c.ProductName, c.ProductCatagoryDesc, c.ProductPrice, c.ProductStatusDesc, c.ProductBuyingPrice, c.ProductQuantity }); //crystalReportsViewer2.ViewerCore.ReportSource = report2; }; }
/// <summary> /// Attaches debugger to the running process. /// </summary> /// <param name="pid">Process id</param> /// <param name="desiredVersion">the desired version of the runtime - you don't need to /// provide the whole version string as only the first n letters /// are compared, for example version string: "v2.0" will match /// runtimes versioned "v2.0.1234" or "v2.0.50727". If <code>null</code> /// is given, the first found runtime will be returned.</param> /// <param name="options">The options.</param> /// <returns></returns> public static CorDebugger CreateDebuggerForProcess(Int32 pid, String desiredVersion = null, CorDebuggerOptions options = null) { ICLRMetaHost metahost = NativeMethods.CLRCreateInstance(ref CLSID_ICLRMetahost, ref IID_ICLRMetahost); Process proc = Process.GetProcessById(pid); IEnumUnknown runtimes = metahost.EnumerateLoadedRuntimes(proc.Handle); ICLRRuntimeInfo runtime = GetRuntime(runtimes, desiredVersion); if (runtime == null) { throw new RuntimeNotFoundException(); } return(CreateDebugger(runtime, options ?? new CorDebuggerOptions())); }
static RuntimePolicyHelper() { ICLRRuntimeInfo runtimeInterfaceAsObject = (ICLRRuntimeInfo)RuntimeEnvironment.GetRuntimeInterfaceAsObject(Guid.Empty, typeof(ICLRRuntimeInfo).GUID); try { runtimeInterfaceAsObject.BindAsLegacyV2Runtime(); LegacyV2RuntimeEnabledSuccessfully = true; } catch (COMException exception) { Console.WriteLine(exception.Message); LegacyV2RuntimeEnabledSuccessfully = false; } }
private void aftermost() { try { ICLRRuntimeInfo rtInfo = (ICLRRuntimeInfo)RuntimeEnvironment.GetRuntimeInterfaceAsObject(Guid.Empty, typeof(ICLRRuntimeInfo).GUID); rtInfo.BindAsLegacyV2Runtime(); report.Load("../../CrystalReport2.rpt"); report.SetDataSource(from c in product.SaleReportCollection select new { c.Billid, c.Current_DateTime, c.Employee_Name, c.Product_id, c.Product_Name, c.Product_Quantity, c.Optionid, c.Optionname, c.OptionQty, c.Total, DFS, DTS, new LoggedInEmployeeModel().FullName }); crystalReportsViewer2.ViewerCore.ReportSource = report; } catch (Exception e1) { Debug.WriteLine("Kush hua hai "); Debug.WriteLine(e1.Message); } }
//private static void IncludeLibrariesInBuildButNotUsedInCode() //{ // Parser_OnlyToIncludeBatchParserDLL = new ManagedBatchParser.Parser(); // Parser_OnlyToIncludeBatchParserDLL = null; // XMLAClient_OnlyToIncludeDLL = new XmlaClient(); // XMLAClient_OnlyToIncludeDLL = null; // Culture_OnlyToIncludeDLL = new Culture(); // Culture_OnlyToIncludeDLL = null; //} static RuntimePolicyHelper() { ICLRRuntimeInfo clrRuntimeInfo = (ICLRRuntimeInfo)RuntimeEnvironment.GetRuntimeInterfaceAsObject( Guid.Empty, typeof(ICLRRuntimeInfo).GUID); try { clrRuntimeInfo.BindAsLegacyV2Runtime(); LegacyV2RuntimeEnabledSuccessfully = true; } catch (COMException) { // This occurs with an HRESULT meaning // "A different runtime was already bound to the legacy CLR version 2 activation policy." LegacyV2RuntimeEnabledSuccessfully = false; } }
public static DebugContext ForRuntime(ICLRRuntimeInfo runtime) { var versionBuilder = new StringBuilder(); var versionBuilderCapacity = versionBuilder.Capacity; runtime.GetVersionString(versionBuilder, ref versionBuilderCapacity); var version = versionBuilder.ToString(); DebugContext debugContext; if (!DebugContexts.TryGetValue(version, out debugContext)) { DebugContexts.Add(version, debugContext = new DebugContext(runtime)); } return debugContext; }
public static void AttachToProcess(Int32 pid) { Process proc = Process.GetProcessById(pid); ICLRMetaHost metahost = NativeMethods.CLRCreateInstance(ref metahost_clsid, ref metahost_riid); IEnumUnknown runtimes = metahost.EnumerateLoadedRuntimes(proc.Handle); ICLRRuntimeInfo runtime = RTHelper.GetRuntime(runtimes, "v4.0"); ICorDebug codebugger = CreateDebugger(runtime); codebugger.Initialize(); codebugger.SetManagedHandler(new ManagedCallback()); ICorDebugProcess coproc; codebugger.DebugActiveProcess(Convert.ToUInt32(pid), 0, out coproc); Console.ReadKey(); }
public static ICLRRuntimeInfo GetRuntime(IEnumUnknown runtimes, String version) { Object[] temparr = new Object[3]; uint fetchedNum; String highestVersion = null; ICLRRuntimeInfo result = null; do { runtimes.Next(Convert.ToUInt32(temparr.Length), temparr, out fetchedNum); for (int i = 0; i < fetchedNum; i++) { ICLRRuntimeInfo t = (ICLRRuntimeInfo)temparr[i]; // initialize buffer for the runtime version string StringBuilder sb = new StringBuilder(16); UInt32 len = Convert.ToUInt32(sb.Capacity); t.GetVersionString(sb, ref len); // version not specified we return the first one if (!String.IsNullOrEmpty(version)) { if (sb.ToString().StartsWith(version, StringComparison.Ordinal)) { return(t); } } else { if (highestVersion == null || String.CompareOrdinal(version, highestVersion) > 0) { highestVersion = version; result = t; } } } } while (fetchedNum == temparr.Length); return(result); }
private async void aftermost() { try { ICLRRuntimeInfo rtInfo = (ICLRRuntimeInfo)RuntimeEnvironment.GetRuntimeInterfaceAsObject(Guid.Empty, typeof(ICLRRuntimeInfo).GUID); rtInfo.BindAsLegacyV2Runtime(); var a = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); ReportDocument report = new ReportDocument(); report.Load(a + @"/CrystalReport3.rpt"); CustomerLedgerDataSet ds = new CustomerLedgerDataSet(); DataTable dt1 = ds.BillProduct; DataTable dt2 = ds.Customer; // assume columns have been created foreach (var c in billProductModel.BillCollection) { dt1.Rows.Add(c.DateTime, c.Billid, c.Quantity, c.ProductName, c.Rate, c.TotalAmount, c.Status, c.Balance); } dt2.Rows.Add(selectedCustomer.Customerid, selectedCustomer.CustomerName, selectedCustomer.CustomerLocation, selectedCustomer.Customerbalance, selectedCustomer.CustomerLastTally, selectedCustomer.Customerphone); report.SetDataSource(ds); crystalReportsViewer2.ViewerCore.ReportSource = report; } catch (Exception e1) { var win = (MetroWindow)Application.Current.MainWindow; var res1 = await win.ShowMessageAsync(" source: " + e1.Source, e1.Message + " || " + e1.StackTrace + MessageDialogStyle.Affirmative); Debug.WriteLine(e1.Message); } }
public CLRRuntimeInfo(System.Object clrRuntimeInfo) { m_runtimeInfo = (ICLRRuntimeInfo)clrRuntimeInfo; }
private ICorDebug GetDebugger(ICLRRuntimeInfo runTime) { Guid iidICorDebug = typeof(ICorDebug).GUID; Guid clsId = clsIdClrDebuggingLegacy; ICorDebug debugger = (ICorDebug)runTime.GetInterface(ref clsId, ref iidICorDebug); return debugger; }
public CLRRuntimeInfo(System.Object clrRuntimeInfo) { m_runtimeInfo = (ICLRRuntimeInfo)clrRuntimeInfo; }
public ClrRuntimeInfo(object clrRuntimeInfo) { _runtimeInfo = (ICLRRuntimeInfo)clrRuntimeInfo; }