C# Isogram. The code compiles and pass test locally but fails online

My solution for C# Isogram problem compiles locally. All tests are green.
However on the server it fails.

The code:

using System.Text.RegularExpressions;

public static partial class Isogram
    public static bool IsIsogram(string word) => !RepeatingLetterPattern().IsMatch(word);

    [GeneratedRegex(@"(\p{L}).*\1", RegexOptions.IgnoreCase, "en")]
    private static partial Regex RepeatingLetterPattern();

How many tests pass locally? Are you running them all or just one?

What is the test failure message and test code run?

Compile errors online.

We received the following error when we ran your code:

Isogram.cs(8,34): error CS8795: Partial method 'Isogram.RepeatingLetterPattern()' must have an implementation part because it has accessibility modifiers.

All tests passed locally.

Locally compile fine. Online fails. I’ve marked the error point.

Based on the following, removing private on that line may help.

No this is a different issue, where GeneratedRegex does not work in the test runner. I still have to figure out how to solve this.

1 Like