diagnostics

Getting process information in .NET

泪湿孤枕 提交于 2019-12-11 16:42:11
问题 Duplicate of this question. update - This is not an exact duplicate. See my solution. I see a java.exe process in process explorer, and double clicking it gives me its working directory & starting command line arguments. From .NET, I run the following code and get a process with the same PID but the above fields are empty. Apparently, this is documented. foreach (Process process in Process.GetProcessesByName("java")) { ... } So how do I get the correct startinfo field values, without peeking

Convince Webpack to explain its `Can't resolve 'foo'` error

蓝咒 提交于 2019-12-11 06:22:40
问题 How can I convince Webpack to, when it is going to emit Can't resolve 'foo' , also emit information about where it tried to find that library? The error message Can't resolve 'foo' is unhelpful because it is a dead end. The reader has no clue which paths Webpack tried and failed; so there's no information to distinguish: The file is in a known location, Webpack found it there, but for some reason didn't use it. (Implies the need for diagnostic information about why it didn't use it.) The file

How to compare results between C++ and MATLAB?

久未见 提交于 2019-12-11 03:50:30
问题 I have a program that processes 2D array of doubles at several stages. I want to compare its results with MATLAB. I can perhaps use std::cout to print some of 8x8 size blocks the 2D array before and after processing (the algorithm works on blocks) onto the console and then manually type those numbers into MATLAB. But that is error prone and tedius. Is there a way to conviniently get this data into MATLAB? Matlab has built in functions to simplify many things. I want to get the data before and

WCF: How to diagnose faulted channels?

丶灬走出姿态 提交于 2019-12-10 17:00:55
问题 I'm working on shipping in a change for my lab that will hopefully help diagnose some weird channel-faulting weirdness we're seeing. There's a test application that uses DuplexChannelFactory to connect to a couple windows services, and for some reason the channels on this test application seem to be faulting quite a bit. I have plans to implement some retry logic in there, but it would be great to figure out why exactly they're faulting. I know that channel factories and proxy objects all

How do I replace a string variable with a var in Roslyn?

柔情痞子 提交于 2019-12-10 14:33:59
问题 For local declarations like: string a = string.Empty; How can I write a diagnostic to change it to: var a = string.Empty; 回答1: I've put together a code fix with diagnostic. Here's the interesting parts: Implementation of AnalyzeNode from ISyntaxNodeAnalyzer public void AnalyzeNode(SyntaxNode node, SemanticModel semanticModel, Action<Diagnostic> public void AnalyzeNode(SyntaxNode node, SemanticModel semanticModel, Action<Diagnostic> addDiagnostic, CancellationToken cancellationToken) { var

Obviously ambiguous call does not cause a compilation error on GCC

北慕城南 提交于 2019-12-08 17:30:28
问题 I was surprised by the fact that GCC does not consider the call to foo() in the following program ambiguous: #include <iostream> struct B1 { bool foo(bool) { return true; } }; struct B2 { bool foo(bool) { return false; } }; struct C : public B1, public B2 { using B1::foo; using B2::foo; }; int main() { C c; // Compiles and prints `true` on GCC 4.7.2 and GCC 4.8.0 (beta); // does not compile on Clang 3.2 and ICC 13.0.1; std::cout << std::boolalpha << c.foo(true); } The above function call

Roslyn Rename variable const in Majusucle

我的梦境 提交于 2019-12-08 12:41:21
问题 Trying to convert that: const string maj = "variable"; in const string MAJ = "variable"; I'm using a Diagnostic with CodeFix. I've already done the Diagnostic: var localDeclarationConst = node as LocalDeclarationStatementSyntax; if (localDeclarationConst != null && localDeclarationConst.Modifiers.Any(SyntaxKind.ConstKeyword) ) { foreach (VariableDeclaratorSyntax variable in localDeclarationConst.Declaration.Variables) { var symbol = model.GetDeclaredSymbol(variable); if (symbol != null) {

Android diagnostic tool for applications

守給你的承諾、 提交于 2019-12-08 10:50:45
问题 I'm looking for a reliable tool for diagnosing Android apps. I want to get the data of Battery usage and CPU usage. I would prefer to get it in real-time, like those of the built-in Developer Tools, but getting the data after few minutes of using the apps is also fine. The at&t ARO app is great, but it works only on emulators, and I have to check the apps on a real device, because I'm using the camera, with a lot of image-processing. If I could find a tool like ARO, but for real devices - it

How to suppress warning (converted from error) in IAR EWARM 5.4

匆匆过客 提交于 2019-12-07 20:11:06
问题 I had a macro for logging that accepts a variable number of arguments. This macro will be processed by GCC in a non-embedded context, and expands to valid C code. Despite this, IAR EWARM gives the error "[Pe054]: too few arguments in macro invocation" wherever I call the macro (thousands of locations) EWARM does provide diagnostics configuration to convert these errors to warnings (and hilariously enough, the code compiles when you do this (i.e. the "error" isn't a compilation error, the

GCC's two unusual error messages

不问归期 提交于 2019-12-07 16:00:49
问题 Today, I came across two error messages which I never seen before. It's completely new to me. Here is the code: template<typename T> struct adder { adder(const T &item) { } }; template<typename T> void initializer(const T &item) { adder<T>(item); } int main() { initializer("const string literal"); } On compiling, GCC gives these errors: prog.cpp: In function ‘void initializer(const T&)’: prog.cpp:6: error: declaration of ‘adder<T> item’ shadows a parameter prog.cpp: In function ‘void