Smart refactoring using Roslyn CTP [closed] - c#

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I'm running some analysis tools on our build like StyleCop/FXCop.
What i'd like to achieve is auto-correct some of the warnings produced by these.
Do you think this can be done using the Roslyn CTP? is there any other tool that allows:
Scanning my code text for some rule not being followed.
Replacing this with the correct code.
Some of the operations can be done using a simple text replace of the VS editor, but more complicated things require use of some other tool.
So my question is - to this end, is the Roslyn CTP the tool to use? or what other tools exist for .NET for doing this?

This is certainly one of the scenarios that Roslyn addresses. Take a look at this walkthrough that demonstrates how to write a "Quick Fix" using Roslyn. In fact, the CTP also ships with a couple of samples that demonstrate how one could write stylecop / fxcop style rules using Roslyn.
You can also glance through this document for an overview of the overall scope of the CTP.
Disclaimer: I work for Microsoft on the Roslyn team.

OP asks, "what other tools exist for .NET for doing this?"
Our DMS Software Reengineering Toolkit is a source-to-source program transformation tool.
DMS can parse, analyze, and transform source codes for many computer languages such as C++, Java, COBOL, and particularly including C#. It can also handle multiple languages simultaneously.

Related

Implementation Standard for C# code? Does it exist? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I've recently been tasked with pulling together 4 independent developers at my company into a cohesive team that generates similar (and good) code as a team.
We're implementing the use of iDesigns C# coding standard which will help our code look similar, and does give some implementation guidelines, but is there a general standard, rules of thumb (Top 10) out there for how code should be built, what every class should 'have' or 'do'?
I read this article by John Connelly about implementation practices, but am not having much luck in finding more references on the subject.
Is there a Implementation 'standard' out there for c# classes/projects? or is it such a broad subject that it can't be defined?
My favorites:
http://csharpguidelines.codeplex.com/releases/view/46280
Microsoft's Design Guidelines for Developing Class Libraries
StyleCop
Although it isn't a standard as such, I'd strongly recommend considering the use of StyleCop. It's a highly customizable Visual Studio plugin that allows you to easily enforce coding standards. Additionally it can be integrated into your cruise control server build, so that if any of those standards aren't adhered to, it breaks the build.
A very useful little tool, that at first I hated, but now I love.
The only C# standard C# has is the "Standard ECMA-334 C# Language Specification". Anything beyond that is up to the developer to do as they wish as they code their program.
Now there are some good rules of thumb to follow (like the two you referenced) but they are just rules of thumb. As long has the entire team is consistent with each other you can do whatever you want as a "standard".

How can you organise F# code in a similar way to C# regions? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Is there a feature equivalent to C#'s regions for being able to group code into named blocks and collapse and expand them?
Alternatively, are there any workarounds or third party tools available to achieve the same result?
One possible workaround might be using F# Outlining VS Extension that provides //#region outlining functionality. I use it with VS2010 for couple of months without any problems and find it very convenient:
[-]//#region Region Name
--lines of F# code--
--lines of F# code--
--lines of F# code--
//#endregion
with one click collapses to
[+]Region Name
and back.
I found times ago (out of mine curiosity) the link the was searching on for asking this question.
If you look at Regions and navigation bar for F# in Visual Studio the guy seems implemented an experimental feature. Post of firsts of 2012, so it's pretty fresh stuff.
Should say that I didn't try it till now.
Good luck.

What are some of the best-written open-source projects you have seen? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
What are some of the open source projects out there that you would hold up as shining examples of projects that correctly and effectively use enterprise sofware patterns and best practices such as Inversion of Control, Model-View-Controller, Unit Testing, etc.?
For purposes of this question the project should:
Include source code that illustrates the pattern in use, and
Be doing something important and useful, i.e. not using the pattern frivolously just because it is flavor of the week. Hence the words, "Correctly and Effectively" in the question
It should be software that you could show to the people who work for you and enthusiastically be able to say, "I want you to do it the way these guys did it."
Most of the GNU project is very very well written, over a very long period of time, with strict guidelines.
Prism is very good for MVVM in WPF and Silverlight
patterns they use Patterns in the Composite Application Library
An objective pick would be the Spring Batch project.
How did I pick it? Judging from the technical debt as seen on the Nemo Sonar instance, Spring Batch has the lowest debt/line ratio for projects larger than 10k lines of code.
When I first looked at the source code for DotNetBlogEngine, I was impressed at how well it was organized. And it didnt couple any of its components to the interface, making it extremely flexible.
It's not a terribly huge project either, not like trying to recompile your own linux kernal or something. So you can dive in quickly and have some fun with it.
Castle project
You can try this book - Beautiful Code
The author has collected some experience-sharing articles of open source projects. e.g. Python's Dictionary Implementation, Subversion's Delta Editor, etc.
You mean Spring? Or projects that use it?
UPDATE: WebWork, Guice, and Spring Security all fit the mold.

A .net disassembler/decompiler [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
I am looking for a disassembler or better, a decompiler for .net. The situation is that the source code for an assembly written by one of my predecessors is lost and I'd like to take a look to see what it's doing.
I know that ildasm comes with the Visual Studio installation so I can get at the MSIL, but I was hoping there was a program clever enough to work back to the C# code (or best approximation).
Are there any tools for this out there?
(If not, I suppose it'll be a good excuse for me to sit down and start to learn MSIL)
Now that Red Gate have started charging for the .NET Reflector tool you might want to check out these free alternatives instead...
Telerik JustDecompile
JetBrains dotPeek
(Open Source) ILSpy
Have you looked at Reflector?
http://www.red-gate.com/products/reflector/
Reflector is the way to go, but if you can't use that for some reason, Microsoft ships a disassembler called ILDasm with the framework.
A good source for MSIL knowledge is the book Expert .NET 2.0 IL Assembler by Serge Lidin.
.NET Reflector is the usual tool for this.
Reflector.
Ok,
I tried on a project.
ILSpy
Telerik JustDecompile
.NET Reflector Demo
All can create Visual C# project.
The generated code did not compile for JustDecompile and Reflector.
In one case, ILSpy made a code that compiled (just references had to be set)
The mistakes IlSpy did not look as compiicated as one found in others.
All generated code can be fixed if one know C# well enough.
An interesting direction can be used to decompile code using both JustDecompile and Ilspy and merge the codes that are correct because these decompilers (and third as well) seem to make different mistakes.

Is there any .NET API using rsync? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I need to have a file synchronizing feature in my .NET application. Can I make use of rsync? Is there any API available?
There is a C# implementation of RSync on github with some recent commits:
http://github.com/MatthewSteeples/rsync.net
DeltaCopy is just a wrapper around the rsync executable. However, librsync itself can be built on Windows as well as UNIX and GNU/Linux (see their README and this EE thread). Thus, that's another option to consider. You would still need some kind of unmanaged-managed interop.
You can use the source code that comes with DeltaCopy, which is a "'Windows Friendly' wrapper" to the original RSync.
The source is written in c++, so it's not exactly .Net, but you can write managed C++ wrappers and use them.
It's not a direct solution, I know, but it may be somewhat helpful. (in other words, HTH)
If you are looking for some simple automation you could just write a tiny wrapper that invokes RSync via System.Diagnostic.Process
I did read somewhere that someone circa 2006 created an rsync port in C#, but to be honest with you I would not consider using it cause its far from popular and impossible to find.

Categories