This week I contributed my fourth and final pull request for Hacktoberfest. For my final pull request for Hacktoberfest, I either wanted to contribute to a repository that uses a different language including either Python/C# or contribute to another large well known repository. For this pull request I found a repository that uses C# and it was a bug where the .Contains() function does not work. This is the first time that I touched C# and has always been one of the languages that I wanted to learn. Although this repository was small, this was a great way to learn a new language, install C# into my visual studio and have some more interactions with the open source community.


Image for post
Image for post

Password-Checker is a simple C# console application used to check the strength of the inputted string. The password checking logic checks for the following parameters: password length, lowercase, uppercase, digits and special characters. According to this issue the code was taken from Codecademy, but the built in functions were substituted for regular C# functions to work on your local machine.


The first issue that I encountered is that my Visual Studio does not have the C# packages installed. So the first step was to get the initial code to work which included installing the .Net Framework from the NuGet installer in Visual Studio.

The installation went smoothly, but as I looked through the code everything looked like it should work.

string specialChars = “!@#$%^&*()-_+=\\/’:,{}[]~.”;
if (password.Contains(specialChars))

This is one of the contains() statements which consists of variables such as password which is the string that you enter and it checks to see if there are special characters, if this statement is true then it increments. I read the instruction to the .Contains() function on many of the different documentation platforms including Microsoft, GeeksForGeeks, Javatpoint, and many Stack Overflow posts, but nothing seems to work. I looked through to project files to figure out if the Codecademy code consists of additional files, but could not find any. When all attempts fail to get the current code working with the normal .contains() statement, the only option left was to create your own contains() function to use as a substitute.


As i browsed for solutions on this .contains() statement, I landed upon a forum post for this C# exercise. In this forum post, they had a link to all the files that Codecademy uses for this exercise.

public static bool Contains(string target, string list)
return target.IndexOfAny(list.ToCharArray()) != -1;

This was the Contains function that is used by this original exercise code.

public static class StringExtensions {
public static bool Contains(this String str,
String substr,
StringComparison cmp)
if (substr == null)
throw new ArgumentNullException(“substring substring”,
“ cannot be null.”);
else if (!Enum.IsDefined(typeof(StringComparison), cmp))
throw new ArgumentException(“comp is not a member of”,
“StringComparison, comp”);

return str.IndexOf(substr, cmp) >= 0;

This is the Contains function from Microsoft Docs

The functions are very similar as it checks to see if there are any instances of the search string by checking the index of the string. As stated by the post, they only wanted to practice the workflow. So instead of using the second function from Microsoft Docs, I used the first one as that is the one used by the original Codecademy code.

Image for post
Image for post

After that function was placed, all the Contains statements were changed to the new function Contains(string target, string list) function.

Learning Experience

In the progress of finishing this pull request, I learned the basic syntax of C# and that C# is very similar to the programming language C. I never got the chance to explore and learn C#, so this was a surprise as the syntax are basically identical. Surprisingly this was the first time that I had to install a package into Visual Studio as I only had the console application for C/C++ installed, making this a new experience. The approach I took for this pull request did not work as intended, just like many programmers when a coding problem arise they head to stack overflow or tutorials.

Image for post
Image for post

In this issue he mentioned Contains() method does not work here because of Codecademy code. For next time when i search for the issue, I will use more key words as others may be facing the same issue.

Interacting with the community

The maintainer was really glad to receive this pull request. When i commented on the post saying that I would like to solve this issue, the maintainer responded in the next hour. This was the most satisfying feeling as the other pull request took days to for the maintainers to respond.

Image for post
Image for post

I really enjoy to work on smaller projects as it is on a more personal level where you can interact freely with another developer. Although this is the case for smaller projects, in my opinion contributing to a larger project has it perks as well. In larger projects, I feel like it is more satisfying once your pull request gets merged after all the tests and policies.


Issue # 4

Project —

Issue —

Pull Request —

Written by

Hi my name is Ryan Wilson and these blogs are for a course called OSD600

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store