Compiler Issue

I’ve come across what appears to be a compiler bug, wondering if anyone else has had a similar problem or has any insights?

Due to a lack of available hardware I’ve finally had to bite the bullet and move our NetMF application, which has been happily running on EMX and G120 boards since around 2011, on to Sitcore and TinyCLR. Over 13,000 lines of source code, it took several days modify hardware specific calls to their TinyCLR equivalents (or comment out for now), I finally had something with no errors, ran a build, and got:

CS7038 Failed to emit module `Anodemeter`: Unable to determine specific cause of the failure.

Not very helpful!

So after a couple more days trying to come up with a minimal example, I have this:

using System;
using System.Collections;
using System.Diagnostics;
using System.Text;
using System.Threading;

namespace TinyCLRApplication1
    internal class Program
        static void Main()
            string s1 = "ABC123";
            string s2 = "456789";

            Debug.WriteLine(s1 + " IsNumbersOnly = " + s1.IsNumbersOnly());
            Debug.WriteLine(s2 + " IsNumbersOnly = " + s2.IsNumbersOnly());

    public static class Extensions
        public static bool IsNumbersOnly(this string arg)
            bool res = false;

            if (arg != null && arg.Length > 0)
                res = true;     
                foreach(char c in arg)
                    if (c < '0' || c > '9')
                        res = false;
            return res;

The IsNumbersOnly extension method has been in the code forever, and I can’t see anything wrong with it. The example builds and runs as a Windows console application. But as a TinyClr application it causes the aforementioned error at the foreach(char c in arg) line.

I’ve tried on VS2019 and VS2022 with the same result. It seems to me it must be a compiler error, in that if there is an error in the code it should at least give some indication as to where it is!

Of course once found it is pretty simple to work around the compiler hiccup, but those days wasted trying to locate it I won’t get back!

Perhaps someone can run the code and see if it is a general problem, or just with my setup?

there is an issue with string enumeration .


Thanks for confirming, Mike.

So it appears this has been a known bug for over 3 1/2 years now with no action taken, the compiler giving not so much as a hint about what or where the problem is. It is in something that worked fine in NetMF from at least 4.2 and probably before. And they are have the temerity to call it “Production Ready”? Sheesh!

Documented known issue with easy workaround.

Without knowing complexity of fix, priorities of other issues, and available resources I hesitate to make any negative comments.

Of course, when I ran into this issue my vocabulary reverted to the days when I worked for an ex navy captain.

Workaround is easy, finding the problem source isn’t.

When you have over 13,000 lines of souce code written by several engineers over the last decade, and the compiler gives you absolutely NO indication of where or what the problem is, I would call that a high priority!