Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to save csx script as macro #1436

Open
jonharb opened this issue Jan 31, 2025 · 2 comments
Open

Unable to save csx script as macro #1436

jonharb opened this issue Jan 31, 2025 · 2 comments
Labels
template: issue Issue report created by user, needs to be triaged

Comments

@jonharb
Copy link

jonharb commented Jan 31, 2025

Description

I have a custom code which I don't want to publish. I cannot save this as a macro with this unhelpful message 'Script contains errors and cannot be saved as a macro'. Is there any way to find out why validation failed? Another option would be to show you the script.

Tabular Editor 3 Version

3.19.0

Screenshots

Image

Steps to Reproduce

No response

Expected behavior

No response

Crash Report

This is a part of the MacroActionsError.log:

(159,29) error: } expected
(526,1) error: } expected
(528,6) error: ; expected
(528,18) error: Tuple must contain at least two elements.
(528,18) error: ) expected
(528,18) error: Type or namespace definition, or end-of-file expected
(528,36) error: ; expected
(528,36) error: Type or namespace definition, or end-of-file expected
(529,33) error: A namespace cannot directly contain members such as fields, methods or statements
(529,39) error: Tuple must contain at least two elements.
(529,40) error: Type or namespace definition, or end-of-file expected
(530,33) error: A namespace cannot directly contain members such as fields, methods or statements
(530,37) error: Type expected
(530,37) error: Tuple must contain at least two elements.
(530,37) error: ) expected
(530,37) error: Type or namespace definition, or end-of-file expected
(530,48) error: A namespace cannot directly contain members such as fields, methods or statements
(530,54) error: Type or namespace definition, or end-of-file expected
(534,4) error: Type or namespace definition, or end-of-file expected
(534,27) error: Tuple must contain at least two elements.
(534,28) error: Type or namespace definition, or end-of-file expected
(535,17) error: A namespace cannot directly contain members such as fields, methods or statements
(535,22) error: Type or namespace definition, or end-of-file expected
(536,19) error: A namespace cannot directly contain members such as fields, methods or statements
(536,24) error: Type expected
(536,24) error: Tuple must contain at least two elements.
(536,24) error: ) expected
(536,24) error: Type or namespace definition, or end-of-file expected
(537,8) error: A namespace cannot directly contain members such as fields, methods or statements
(537,16) error: Type or namespace definition, or end-of-file expected
(537,64) error: Identifier expected
(537,69) error: Identifier expected
(538,8) error: Type or namespace definition, or end-of-file expected
(539,17) error: A namespace cannot directly contain members such as fields, methods or statements
(539,24) error: Type or namespace definition, or end-of-file expected
(540,19) error: A namespace cannot directly contain members such as fields, methods or statements
(540,24) error: Type expected
(540,24) error: Tuple must contain at least two elements.
(540,24) error: ) expected
(540,24) error: Type or namespace definition, or end-of-file expected
(541,8) error: A namespace cannot directly contain members such as fields, methods or statements
(541,16) error: Type or namespace definition, or end-of-file expected
(541,62) error: Identifier expected
(541,67) error: Identifier expected
(542,8) error: Type or namespace definition, or end-of-file expected
(543,17) error: A namespace cannot directly contain members such as fields, methods or statements
(543,22) error: Type or namespace definition, or end-of-file expected
(544,19) error: A namespace cannot directly contain members such as fields, methods or statements
(544,24) error: Type expected
(544,24) error: Tuple must contain at least two elements.
(544,24) error: ) expected
(544,24) error: Type or namespace definition, or end-of-file expected
(545,8) error: A namespace cannot directly contain members such as fields, methods or statements
(545,16) error: Type or namespace definition, or end-of-file expected
(545,60) error: Identifier expected
(545,65) error: Identifier expected
(546,8) error: Type or namespace definition, or end-of-file expected
(547,17) error: A namespace cannot directly contain members such as fields, methods or statements
(547,23) error: Type or namespace definition, or end-of-file expected
(548,19) error: A namespace cannot directly contain members such as fields, methods or statements
(548,24) error: Type expected
(548,24) error: Tuple must contain at least two elements.
(548,24) error: ) expected
(548,24) error: Type or namespace definition, or end-of-file expected
(549,8) error: A namespace cannot directly contain members such as fields, methods or statements
(549,16) error: Type or namespace definition, or end-of-file expected
(549,61) error: Identifier expected
(549,66) error: Identifier expected
(550,8) error: Type or namespace definition, or end-of-file expected
(552,19) error: A namespace cannot directly contain members such as fields, methods or statements
(552,24) error: Type expected
(552,24) error: Tuple must contain at least two elements.
(552,24) error: ) expected
(552,24) error: Type or namespace definition, or end-of-file expected
(552,67) error: A namespace cannot directly contain members such as fields, methods or statements
(552,75) error: Type or namespace definition, or end-of-file expected
(555,0) error: Type or namespace definition, or end-of-file expected
(556,8) error: Type or namespace definition, or end-of-file expected
(557,8) error: Top-level statements must precede namespace and type declarations.
(557,8) error: The modifier 'public' is not valid for this item
(561,4) error: Type or namespace definition, or end-of-file expected
(562,0) error: Type or namespace definition, or end-of-file expected
(528,24) error: The modifier 'new' is not valid for this item
(528,24) error: Method must have a return type
(537,58) error: The type or namespace name 'client' could not be found (are you missing a using directive or an assembly reference?)
(537,66) error: The type or namespace name 'uri' could not be found (are you missing a using directive or an assembly reference?)
(537,18) error: The type or namespace name 'await' could not be found (are you missing a using directive or an assembly reference?)
(537,24) error: '.generateDescriptionsForEverything(client, uri)' must declare a body because it is not marked abstract, extern, or partial
(541,56) error: The type or namespace name 'client' could not be found (are you missing a using directive or an assembly reference?)
(541,64) error: The type or namespace name 'uri' could not be found (are you missing a using directive or an assembly reference?)
(541,18) error: The type or namespace name 'await' could not be found (are you missing a using directive or an assembly reference?)
(541,24) error: '.generateDescriptionsForMeasures(client, uri)' must declare a body because it is not marked abstract, extern, or partial
(545,54) error: The type or namespace name 'client' could not be found (are you missing a using directive or an assembly reference?)
(545,62) error: The type or namespace name 'uri' could not be found (are you missing a using directive or an assembly reference?)
(545,18) error: The type or namespace name 'await' could not be found (are you missing a using directive or an assembly reference?)
(545,24) error: '.generateDescriptionsForTables(client, uri)' must declare a body because it is not marked abstract, extern, or partial
(549,55) error: The type or namespace name 'client' could not be found (are you missing a using directive or an assembly reference?)
(549,63) error: The type or namespace name 'uri' could not be found (are you missing a using directive or an assembly reference?)
(549,18) error: The type or namespace name 'await' could not be found (are you missing a using directive or an assembly reference?)
(549,24) error: '.generateDescriptionsForColumns(client, uri)' must declare a body because it is not marked abstract, extern, or partial
(557,8) error: Program using top-level statements must be an executable.
(557,27) warning: The local function 'Enabled' is declared but never used
(17,66) error: '__MacroAction' does not contain a definition for 'Enabled'
(208,25) error: The name 'Selected' does not exist in the current context
(212,25) error: An object reference is required for the non-static field, method, or property 'Model.Tables'
(357,23) error: The name 'Selected' does not exist in the current context
(361,23) error: An object reference is required for the non-static field, method, or property 'Model.Tables'
(444,24) error: The name 'Selected' does not exist in the current context
(448,24) error: An object reference is required for the non-static field, method, or property 'Model.Tables'
using System;
using System.Linq;
using System.Collections.Generic;
using Newtonsoft.Json;
using TabularEditor;
using TabularEditor.TOMWrapper;
using TabularEditor.TOMWrapper.Utils;
using TabularEditor.Shared;
using TabularEditor.Shared.Scripting;
using TabularEditor.Shared.Interaction;
namespace TabularEditor.Shared.Scripting
{
public static class __MacroActionsGenerator
{
public static void __GenerateMacroActions(IMacroActionCreator __mac)
{
// Action 0, valid contexts: Model, Table, Measure, Column
__mac.CreateMacroItem(0, "test", Macro0.__MacroAction.Enabled, Macro0.__MacroAction.Execute, (Context)14337);
}
}
}
namespace Macro0
{
using System.Net.Http;
using System.Text;
using Newtonsoft.Json.Linq;
using System.Threading.Tasks;
public class SimilarMeasure
{
public double Similarity;
public Measure Measure;

public SimilarMeasure(double similarity, Measure measure){
    Similarity = similarity;
    Measure = measure;
}   

}
public class SimilarTable
{
public double Similarity;
public Table Table;

public SimilarTable(double similarity, Table table){
    Similarity = similarity;
    Table = table;
}   

}

Windows Version

11

@jonharb jonharb added the template: issue Issue report created by user, needs to be triaged label Jan 31, 2025
@MariaJoseFF
Copy link
Collaborator

Hi @jonharb,

Does your custom code execute successfully without validation errors before you try to save it as a macro?

If you would rather take this offline so we can look at the script, feel free to e-mail [email protected].

Kind regards,
Maria José Ferreira
Core Developer at Tabular Editor

@jonharb
Copy link
Author

jonharb commented Jan 31, 2025

Yes, definitely. I'll post my code to your mail address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
template: issue Issue report created by user, needs to be triaged
Development

No branches or pull requests

2 participants