How to build Selenium .NET6 from source code? - c#

I was thinking about make some modifications on the selenium Source code but when generating the build, multiple errors were thrown. I think I am overlooking some necessary aspect.
In the selenium documentation, it is mentioned that Bazel is used for the build, but also that Bazel cannot do the build for C#. Does anyone know how this is done?

Related

Force Compile Error in Release Build but not Debug Build in C#

We have a situation where a piece of code we've written fails against a test instance of our database because of work yet undone in the database itself. (It's a patching issue on an AS/400 that is completely out of our control) We have to move forward with development and can using a hack for the code in question. We need to make sure that this hack never makes it into the production environment and were wondering if there was a way to make code build correctly when compiling for the Debug configuration but fail with a compiler error when the Release configuration is being built? I've started looking into the build configuration but have yet to find a good approach. Any ideas would be appreciated.
We're using VS 2008, C#, .Net 3.5
Use compiler directives like this:
#if !DEBUG
#error Must not make it into production
#endif
Ideally you would like to add a more complete comment describing why you can't let the hack go into production, detailing the steps or cases in your issue tracker that needs to be completed before it is safe, etc. etc.

ANTLR C# Can't find 'IAstRuleReturnScope'

I have downloaded the csharp grammar project from here http://antlrcsharp.codeplex.com/releases/view/47523, and it runs fine.
But when I add 'output=AST' to the grammar, I get a TON of errors:
I am admittedly new to ANTLR, so I am not sure how to proceed at this point. I would have assumed this type would have existed in the antlr csharp runtime dll, but obviously not. Has anyone come across this problem before?
I ran into this migrating from a v3.2 script generating from the Java tool to using v3.4 with the dotNet build tools.
I was able to figure out (thx to the documentation that comes with the .net VS integration) that the problem with not getting the right return type was because a class is only generated if you have a return type on the rule. Adding a dummy integer return type to my rules that had no return value cleared that up.
There is a discussion of the rule returns in the C# generator and target in the documentation from the C# target page at antlr, follow the link at the top of the page and check out section 4.1.1 "Return values"
About a year ago I did a project with Antlr and ran into an issue where I got tons of errors. As odd as it sounds but by using an older runtime I got it to work. I think I used a dll that had been compiled for the 2.0 .Net Framework.
I do not remember exactly what the error was or what had actually caused it. All I remember is that it solved the issue. I have no idea if this will help in your situation but it's worth a shot if you are stuck.
You are not the first person to have this problem. The patch at https://github.com/antlr/antlr/pull/1 addresses it by providing the missing file. Include it in your source and recompile.

How to find out what code in a C# .NET assembly is not being called

I have a C# .NET assembly, in visual studio 2008. If required I could upgrade it to VS 2010.
How can I find which code in the assembly is not called? Ideally if something could analyse the whole solution in one go. It is too much for me to analyse it all myself manually.
The assembly is shared between a client and server project so I need to understand which code is used where.
In VS 2010 you can use code coverage together with unit tests for that - so if you can refactor your client code into actual unit tests you can use that.
To quote from MSDN:
To determine what proportion of your
project's code is actually being
tested using unit tests, you can use
the code coverage feature of Visual
Studio Application Lifecycle
Management. To do this, first edit the
run configuration to indicate the
assembly that contains the code whose
coverage you want to measure. Then run
tests on that code. Detailed code
coverage statistics appear in a
window, and you can also see,
line-by-line, which code has been
tested.
Try getting resharper. That does that for you. You can get a free trial version from their website. http://www.jetbrains.com/resharper/download/
http://www.jetbrains.com/resharper/
Providing you don't mind buying something to do it, ReSharper will go off and find unused code for you.
FxCOP is a free tool from Microsoft that includes dead code detection.
For best resulsts, don't mark classes/methods public unless they really need to be public. It assumes that any public method is used by external assemblies.
Check Code Analysis in Visual Studio, help here.
You could try the safe delete function of ReSharper, keeping in mind it will say it's safe to delete code which is only used via reflection (such as Fluent automapping conventions).
Couldn't hurt to download a 30 day trial to see if it does what you need anyhow.

C# debugging across dlls

I have a project which has a calling structure similar to this:
main project/application
my library code
someone else's library code
my library code
Everything's written in C#, and I have access to 'someone else's library code'. Their code is not included in my project, because it's open source and not my code. I can make debug versions of all the libraries, and I've done so.
That 'someone else's library code (SELC, I guess?) is throwing an exception in a heisen-bug kind of way, and I'm trying to track it down and maybe submit a bugfix to the project maintainer. Problem is, my debugging stack is stopping at my library code, and lists the SELC as 'external' and I can't debug into it. I've copied the pdb files as well as the debug version of the library into the debug directory of my application, and still no luck; I can't seem to debug into their code, and I can't step into it at all.
Once upon a time, back in vs6 days, I could do this-- have two different projects open at the same time in two different environments, and have the debugger trace across dll boundaries from one project into another. I'd assume that functionality remains, because it's just so dang useful.
Any suggestions?
I've looked for this answer but not found it, so if this is a dupe, just let me know where to look.
Do you have "Just My Code" turned on in Visual Studio's debugging options?
If you have the sources (as i read from you), you can make an project with their source code, and then add the project to your solution.
In visual studio the project in .csproj file , and solutions in .sln file.

Are there any emacs or vim editors with code completion plugins for C#?

It would be nice if it did both a list of methods to choose from and the list of potential input parameters. This was done for powershell and I was curious if there was any similar functionality implemented for emacs or vim?
Clarification:
A fellow developer I work with wants to use either vim or emacs for the low overhead without running visual studio. In essence he would like to be able to write tests, edit code in emacs or vim then just run NANT scripts to compile the code and run the tests. The only feature from Visual Studio he wants is code completion. The rest he can live without for 98-99 percent of the time.
You can use a vim editor emulator for Visual Studio.
http://www.viemu.com/
I haven't come across an emacs mode that would offer code completion suggestions based on "knowledge" of the API(s) that the user's environment is offering. To a lot of people this is an issue which prevents them from attempting to use Emacs or VIM when working with rich/large/unwieldy (delete as applicable) APIs.
However I am wondering how much of a problem this would present during day-to-day work. I've been using Emacs with C#-mode to crank out quite a lot of C# code. I also tend to run dabbrev-mode or pabbrev-mode, which tends to take care of the more common function and variable names I tend to use. To my eternal shame I have to admit that I tend to have a browser open on the MSDN website to look up the rest - those APIs that I don't use often enough to remember. Another potential helper that your colleague might want to look into is icicles, which may also be a step in the right direction. Neither of these libraries however will offer the full breadth of completion support that something the like Visual Studio IDE will offer. I'd see this as part of the trade-off when using a more efficient editor.
As an aside, if your colleague is working in a team and other members working on the same project are using Visual Studio, MSBuild might offer a better solution for building outside of VS than Nant as MSBuild reads the same solution and project files that VS uses (in fact a lot of the build work in VS2008 is handled by MSBuild). The syntax isn't too far away from Nant and with the community tasks added (which gives you NUnit integration etc) and it'll ensure that everybody is using very similar mechanisms to build the executables.
The furthest along completion I've seen for C# is at this blog, specifically at this post. (Blog link included for context and other Emacs posts.)
If you can live with dumb completion, you might be able to roll your own with tags and tag completion.
A previous stack on the same issue.
Your source code should be processed through the CEDET framework: http://cedet.sourceforge.net/
Then either use the example UIs bundled with cedet or else try any of these two:
- company-mode: http://nschum.de/src/emacs/company-mode
- completion-ui: http://www.dr-qubit.org/emacs.php
both supporting CEDET as a completion search backend.
apa!
for emacs and C# you can look at this tool : http://code.google.com/p/idebridge/
OmniSharp provides contextual intellisense for C# in vim.
Some of the suggestions in Eclipse Style Function Completions in Emacs for C, C++ and JAVA? may be relevant for emacs.
Not c# specific, but still.
I have found the http://code.google.com/p/csense this is an emacs c# intellisense/code sense. I found it from this blog post http://osdir.com/ml/emacs.sources/2007-11/msg00018.html, this may be close to the answer I was looking for.
After looking further it has not been updated since November 2007, looks stale to me.
For Vim, you can install insenvim. It support for the C# code completion.
After download the plugin you could install the installation file or install manually by following steps:
Copy the file cs_vis.vim into your $VIM\vimfiles\ftplugin directory.
Copy the file csft.dll into your $VIM_INTELLISENSE directory.
Copy CSVimHelper.dll,reg.bat to your $VIM_INTELLISENSE directory.
Run reg.bat to register the dlls. You need to set the directory gacutil.exe
in the path. You need the latest version of .NET SDK.

Categories