Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Build validation failed for sketch 'ABC': Illegal characters in path - Solution (Read 1041 times)
TheOzMan
Newbies
*
Offline


Posts: 4
Joined: Jan 5th, 2025
Build validation failed for sketch 'ABC': Illegal characters in path - Solution
Jan 7th, 2025 at 8:43am
Print Post  
Hello All,

I'm posting this for anyone else that comes across this so they don't have to spend days trying to debug it.

The full error is:
Build validation failed for sketch 'ABC': Illegal characters in path. Ide=Arduino 1.6/1.8

If you get this when trying to just save a file in a project (any file), or trying to compile doesn't even really start and returns this error straight way, I have a possible cause for you.

For me, I had two double quotes around an include.
include "ir.h""    instead of    include "ir.h"

Yes it messed up code everywhere, but this was really time consuming to find. There are some old threads about looking at the Arduino IDE configured path, I looked at that, some registry keys, I looked at that, resetting the environment, recreating the project, generating debug files... I did a lot to try and find this.

So, if you get this error, check all your includes don't have an extra double quote as the error message doesn't help you find this at all.

Learn from my pain... Enjoy.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: Build validation failed for sketch 'ABC': Illegal characters in path - Solution
Reply #1 - Jan 7th, 2025 at 9:30am
Print Post  
Thanks for the report and detail around this, we will look at adding further resiliency in this area and improved logging.

If you can attach a full build log for your project with the settings enabled as shown at the top of the page it will help us to further target the issue.
« Last Edit: Jan 7th, 2025 at 11:20am by Simon@Visual Micro »  
Back to top
IP Logged
 
TheOzMan
Newbies
*
Offline


Posts: 4
Joined: Jan 5th, 2025
Re: Build validation failed for sketch 'ABC': Illegal characters in path - Solution
Reply #2 - Jan 7th, 2025 at 9:43pm
Print Post  
Hello,

It's pretty easy to duplicate. Just add an addtional " to an include:
#include "ir.h""
and it'll break.

Nothing complains about the extra double quote.
Just an error saving, and an instance fail when trying to compile.
Included build info as requested.
Everything is default. I'm not using any specical compilier flags etc.


Example, build instance fail:
System.ArgumentException: Illegal characters in path.
   at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
   at System.IO.Path.InternalCombine(String path1, String path2)
   at System.IO.FileSystemEnumerableIterator`1.GetFullSearchString(String fullPath, String searchPattern)
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
   at System.IO.DirectoryInfo.InternalGetFiles(String searchPattern, SearchOption searchOption)
   at Visual.Micro.MiroAppAPI.SketchLibrary.ContainsHeader(String headerName)
   at Visual.Micro.MiroAppAPI.MCUTargetPlatform.getImportedLibsOfSketch(List`1 importedSketchHeaders, Boolean canCache, SketchLibraryListUnSorted local_library_lookup_list)
   at Visual.Micro.MiroAppAPI.MCUTargetPlatform.getImportedLibsOfSketch(List`1 importedSketchHeaders)
   at Visual.Micro.MiroAppAPI.SketchBuilder.preprocess(String buildPath, PdePreprocessor preprocessor, Boolean PreProcessOnly)
   at Visual.Micro.MiroAppAPI.SketchBuilder.preprocess(String buildPath, Boolean PreProcessOnly)
   at Visual.Micro.MiroAppAPI.SketchBuilder._build(String lbuildPath, Boolean verbose, Boolean PreProcessOnly)
   at Visual.Micro.MiroAppAPI.SketchBuilder._build(Boolean verbose)
   at Visual.Micro.MiroAppAPI.SketchBuilder.build(Boolean verbose)
   at Visual.Micro.Visual.Studio.Arduino.AddInApp._CompileDo(Object oProject, Boolean IsDebugStartCommand, Boolean isRebuild, Boolean UseGdbIfAvailable)
   at Visual.Micro.Visual.Studio.Arduino.AddInApp.CompileDo(Object oProject, Boolean IsDebugStartCommand, Boolean isRebuild, Boolean UseGdbIfAvailable)
   at Visual.Micro.Visual.Studio.Arduino.AddInApp.OnBeforeCommandEvent(String sGuid, Int32 ID, Object CustomIn, Object CustomOut, Boolean& CancelDefault)
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: Build validation failed for sketch 'ABC': Illegal characters in path - Solution
Reply #3 - Jan 8th, 2025 at 12:50pm
Print Post  
Thanks for the detail and the log file, we can now reproduce the error with the Serial Debugger enabled.

We will improve the message to show the included file which causes the error to be thrown, and will update this thread when the version is available for download.
  
Back to top
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: Build validation failed for sketch 'ABC': Illegal characters in path - Solution
Reply #4 - Jan 20th, 2025 at 6:06pm
Print Post  
We have improved the error message to show the #include which is at fault when this error occurs in the latest version (25.0120.0), which can be installed from the top of the below board:
https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES
  
Back to top
IP Logged
 
TheOzMan
Newbies
*
Offline


Posts: 4
Joined: Jan 5th, 2025
Re: Build validation failed for sketch 'ABC': Illegal characters in path - Solution
Reply #5 - Jan 20th, 2025 at 10:44pm
Print Post  
Smiley

Thanks.
  
Back to top
 
IP Logged
 
PatFromTraralgon
Newbies
*
Offline


Posts: 2
Joined: Feb 22nd, 2025
Re: Build validation failed for sketch 'ABC': Illegal characters in path - Solution
Reply #6 - Feb 27th, 2025 at 3:10am
Print Post  
TheOzMan wrote on Jan 7th, 2025 at 8:43am:
Hello All,

I'm posting this for anyone else that comes across this so they don't have to spend days trying to debug it.

The full error is:
Build validation failed for sketch 'ABC': Illegal characters in path. Ide=Arduino 1.6/1.8

If you get this when trying to just save a file in a project (any file), or trying to compile doesn't even really start and returns this error straight way, I have a possible cause for you.

For me, I had two double quotes around an include.
include "ir.h""    instead of    include "ir.h"

Yes it messed up code everywhere, but this was really time consuming to find. There are some old threads about looking at the Arduino IDE configured path, I looked at that, some registry keys, I looked at that, resetting the environment, recreating the project, generating debug files... I did a lot to try and find this.

So, if you get this error, check all your includes don't have an extra double quote as the error message doesn't help you find this at all.

Learn from my pain... Enjoy.

  
Back to top
 
IP Logged
 
PatFromTraralgon
Newbies
*
Offline


Posts: 2
Joined: Feb 22nd, 2025
Re: Build validation failed for sketch 'ABC': Illegal characters in path - Solution
Reply #7 - Feb 27th, 2025 at 3:12am
Print Post  
Thanks to TheOZMan.  That solution was spot on.

Pat

Problem: After several days of developing a C++ class to manage a Witmotion HWT095-TTL Inertial Management Unit (IMU), I decided to port the partially developed code from my development environment, an Arduino Mega2560, to the target environment, a UnoR4Wifi. The code compiled, uploaded and executed successfully on the Mega2560.
The code refused to compile for the UnoR4WiFiwith the following error: 
Compiling debug version of 'TestHWT905-TTL' for 'Arduino UNO R4 WiFi (unor4wifi)'
Visual Studio Version: 2022 [17.0]
Build Folder: ug"
System.ArgumentException: Illegal characters in path.

Environment: 
Windows 11 Pro (10.0.22631 Build 22631)
Visual Studio 2022 (17.12.5)
Visual Micro 220.  (2024.620.2203)

Attempted fix:
1.      Set Visual Micro (VM) Compiler to Verbose and Show Build Properties. 
2.      Compiled code for the Mega2560 and saved the output. Compiled the code for the UnoR4WiFi and saved the output.
3.      Used WinMerge to compare the two saved output files. There were many, many differences between the files as they are quite different Arduinos.
4.      Tried changing settings within VM/Visual Studio.  The program compiled correctly when the Solution Configuration was changed from Debug to Release.
5.      Saved the output from both Debug and Release compiles.
6.      Compared the results from step 4 with WinMerge.
a.      vm.solution.configuration_name=Debug, vm.solution.configuration_name=Release
b.      extra.time.local=1740237109, extra.time.local=1740236869
c.      extra.time.utc=1740197509, extra.time.utc=1740197269
d.      ebug, elease
e.      debug.tool=universal, debug.tool=no_debug
f.      build.vm.build.vmdebug=1, build.vm.build.vmdebug=0
g.      4wifi\Debug, 4wifi\Release
7.      All of the differences are as expected. The Release version compiled correctly.  The Debug version gave the error shown above.
8.      Tried other settings changes. No success.
9.      Tried deleting the output folder and starting again. No success.
10.      Considered goat-sacrifice in back yard. Wife vetoed.
11.      Tried another Internet search. Found TheOzMan response from 7/1/2025 with the correct solution on visualmicro.com.
12.      One of my .cpp files (the last one I wrote) had an include with an extra double quote i.e. (#include “filename.h””)

  
Back to top
 
IP Logged
 
TheOzMan
Newbies
*
Offline


Posts: 4
Joined: Jan 5th, 2025
Re: Build validation failed for sketch 'ABC': Illegal characters in path - Solution
Reply #8 - Feb 27th, 2025 at 3:19am
Print Post  
Glad it helped! Unfortunately looks like it already took you days to find (like it did me).
The latest build does show an error now during compile (doesn't complain while saving).
You got there in the end at least...
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint