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
Normal Topic Fatal error compiling with function value templates. (Read 934 times)
M Hotchin
Newbies
*
Offline


Posts: 2
Joined: Jul 11th, 2020
Fatal error compiling with function value templates.
Nov 24th, 2020 at 1:25am
Print Post  
I'm getting a fatal error when compiling using function templates.  I created a new project from the 'Blink' sketch, and I added the following code:
 
template<unsigned int Index>
void InterruptHandler(void)
{
     //interruptCounters[Index]++;
}


When compiled, i get the following error:
 
System.NullReferenceException: Object reference not set to an instance of an object.
   at Visual.Micro.Processing.Sketch.SketchCompilerCTagsRunner.addPrototype(CTag tag)
   at Visual.Micro.Processing.Sketch.SketchCompilerCTagsRunner.addPrototypes()
   at Visual.Micro.Processing.Sketch.SketchCompilerCTagsRunner.TagsParse(String mainFile)
   at no ctx, String sourceFilePath, Board brd, List`1 includePaths, SketchLibraryListUnSorted knownLibs)
   at Visual.Micro.MiroAppAPI.SketchCompilerArduino.TryRunCTags(Board brd, List`1 includePaths, SketchLibraryListUnSorted knownLibs)
   at Visual.Micro.MiroAppAPI.SketchCompilerArduino._compile(SketchBuilder lsketch, String primaryClassName, Boolean verbose, Boolean isDebug)
   at Visual.Micro.MiroAppAPI.SketchCompilerArduino.compile(SketchBuilder lsketch, String primaryClassName, Boolean verbose, Boolean isDebug)
   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.Compile(Object oProject, Boolean IsDebugStartCommand, Boolean IsRebuild, Boolean UseGdbIfAvailable)

The complete build log is attached.
  

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Fatal error compiling with function value templates.
Reply #1 - Nov 24th, 2020 at 4:18am
Print Post  
Hi

There is an update due to be pushed to the gallery but it is available here at the top of the list. It includes some fixed in the area your have an issue with.

Please let us know if that resolves

Thanks
  
Back to top
WWW  
IP Logged
 
M Hotchin
Newbies
*
Offline


Posts: 2
Joined: Jul 11th, 2020
Re: Fatal error compiling with function value templates.
Reply #2 - Nov 24th, 2020 at 5:07am
Print Post  
Version 2020.910.15 fails slightly differently:
 
System.ArgumentNullException: Value cannot be null.
Parameter name: source
   at System.Linq.Enumerable.Contains[TSource](IEnumerable`1 source, TSource value, IEqualityComparer`1 comparer)
   at System.Linq.Enumerable.Contains[TSource](IEnumerable`1 source, TSource value)
   at Visual.Micro.Processing.Sketch.SketchCompilerCTagsRunner.parseTag(String row)
   at Visual.Micro.Processing.Sketch.SketchCompilerCTagsRunner.TagsParse(String mainFile)
   at no ctx, String sourceFilePath, Board brd, List`1 includePaths, SketchLibraryListUnSorted knownLibs)
   at Visual.Micro.MiroAppAPI.SketchCompilerArduino.TryRunCTags(Board brd, List`1 includePaths, SketchLibraryListUnSorted knownLibs)
   at Visual.Micro.MiroAppAPI.SketchCompilerArduino._compile(SketchBuilder lsketch, String primaryClassName, Boolean verbose, Boolean isDebug)
   at Visual.Micro.MiroAppAPI.SketchCompilerArduino.compile(SketchBuilder lsketch, String primaryClassName, Boolean verbose, Boolean isDebug)
   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.Compile(Object oProject, Boolean IsDebugStartCommand, Boolean IsRebuild, Boolean UseGdbIfAvailable)

  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2175
Joined: Feb 13th, 2019
Re: Fatal error compiling with function value templates.
Reply #3 - Nov 24th, 2020 at 10:08am
Print Post  
Thanks for the detail, we can replicate this and will update when a full fix is available.

A workaround in the interim, would be to just add a space after the keyword template:
Code
Select All
template <unsigned int Index>
void InterruptHandler(void) {
 

« Last Edit: Nov 24th, 2020 at 12:54pm by Simon@Visual Micro »  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2175
Joined: Feb 13th, 2019
Re: Fatal error compiling with function value templates.
Reply #4 - Nov 24th, 2020 at 2:08pm
Print Post  
The fix is now available in the latest version (20.09.10.16) from the below board:
https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES

Let us know if you have any further issues.

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint