0

I'm getting these errors:

AnonymousPath\Anonymized.vb : error BC30037: Character is not valid.
AnonymousPath\Anonymized.vb(2) : error BC30627: 'Option' statements must precede any declarations or 'Imports' statements.
AnonymousPath\Anonymized.vb(4) : error BC30465: 'Imports' statements must precede any declarations.

I get as many error BC30465's as Imports

Here's the (anonymized) code the errors point to:

Option Strict On
Option Explicit On

Imports System.Data.Common
'More Imports

I tried cleaning the solution an building again and closing VS2010 and opening it again, and I still get this. I should mention that our solution has VB.NET projects, C# projects and C++/CLI /clr projects that act as wrapper for unmanaged C++ projects. We are slooowly migrating the VB.NET code to C#, that might be related to this issue. Any clues? This might have to do with a cyclic import or something.

2 Answers 2

1

My bad, there REALLY was a bogus character (a space) before the first Option keyword. I saw it with Notepad++, activating the 'view whitespace' option. My sight is not what is used to be, damn the PS2. I deleted it using Notepad++, reloaded it in Visual Studio, and away they went those errors.

However, VS2010 never showed me that space, so he must have a bug. I hope it's just VB.NET related...

3
  • It's possible that it was a different whitespace character, or only half of a CRLF pair.
    – Adam Maras
    Jul 13, 2011 at 18:03
  • It looked just like a space to Notepad++ Jul 13, 2011 at 18:11
  • 1
    True. But Notepad++ is probably a little more forgiving and flexible when it comes to file formats. Visual Studio has historically had some issues with file encoding.
    – Adam Maras
    Jul 13, 2011 at 20:04
1

Perhaps help you. Review your Framework versions in your solution or projects. In my case, I changed the Framework versions and resolved. For example, I changed Framework 4.5.1 by the Framework version 4.5. I haven't trouble now. Of course, this work I maked for WinForm type projects. I hope you can resolved quickly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.