ReSharper - Conditional Compilation XML comment errors

869 Views Asked by At

If I have the following code...

#if PocketPC
        /// <summary>Indicates whether usage of the Windows Mobile 5.0+ GPS intermediate driver is allowed.</summary>
        private static bool allowGpsIntermediateDriver = true;

        /// <summary>Indicates whether the device detection thread is currently active.</summary>
        private static bool isDetectionThreadAlive;
#endif

...ReSharper gives me "xml comment is not placed on a valid language element" errors. Sometimes these can be suppressed with #pragma but mostly they can't. Is there any way around this?

1

There are 1 best solutions below

1
On

Put "#define PocketPC" right at the top of the C# file before any of your c# code seems to work.

I suspended Resharper, and Visual Studio can't pick up the code using find reference (shift F12) if I don't define it first.

I think this is due to the fact that Visual Studio can't analysis the defined preprocessor directives "PocketPC", and may not be a Resharper issue.

Funny thing is that if tried using #if DEBUG, that works only if you set Visual Studio build configuration to Debug. If you change the build configuration to Release, you will have the same problem where Visual Studio doesn't understand #if DEBUG.

It would be nice if you can define this directive globally.