Ticket

CodeGen error in v1.10.2 $20 PayPal Bounty

I do not have my Stripe account set up yet, so I am offering a $20 bounty for some help with this problem.

I am new to Orchard and am in the process of going through the Dojo Course videos provided by Lombiq. (Thank you Lombiq for some great videos!)

I am concerned that I may not be configuring Visual Studio correctly and that is causing the following codegen error. I checked the error log and it was empty.

Please tell me what I am doing wrong or am failing to do.

Thanks very much.

Procedure to re-create codegen error.

1. Copy Orchard Source to a new folder: 
    a. create a new folder
    b. copy OCms v1.10.2 lib and src folders to new folder

2. Rename .sln file from Orchard.sln to OCmsCodeGenErrorTestProj.sln

3. Open solution in Visual Studio 2017 Community. 

4. Build solution to confirm no errors:  Build succeeded. 

5. Start/Configure Web Site
    a. In VS2017, type Ctrl/F5 to start web site
    b. Site name: OCmsCodeGenErrorTestSite
    c. user name: admin
    d. password: password
    e. Data: SSCompact
    f. Recipe: Default

Site started successfully. 

6. Create scaffold for new Theme. 
    a. Using Windows Explorer, under Orchard.Web folder, opened "bin" folder 
    b. right clicked Orchard.exe 
    c. selected "run as administrator" option 
        The command line window appeared. 
    d. at "orchard>" prompt, entered: "feature enable Orchard.CodeGeneration"
        "Code Generation was enabled" message appeared. 
    e. at orchard> prompt, entered: 

codegen theme DojoCourseTheme /CreateProject:true /IncludeInSolution:true /BasedOn:TheThemeMachine

The "Creating Theme DojoCourseTheme" message appeared followed by this error:

---------(beginning of error text)----------------

Error executing command "codegen theme DojoCourseTheme"

Specified argument was out of the range of valid values. Parameter name: startIndex"

Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valiid values. Parameter name: startIndex

Stack Trace:

[ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: startIndex] at System.String.Insert(Int32 startIndex. String value)

at Orchard.CodeGeneration.Commands.CodeGenerationCommands.AddToSolution(TextWriter output, String projectName, String projectGuid, String containingFolder, String solutionFolderGuid)

at Orchard.CodeGeneration.Commands.CodeGenerationCommands.CreateThemeFromTemplates(TextWriter output, String themeName, string baseTheme, String projectGuid, Boolean includeInsolution)

at Orchard.CodeGeneration.Commands.CodeGenerationCommands.IntegrateTheme(String themeName, string baseTheme)

at Orchard.CodeGeneration.Commands.CodeGenerationCommands.CreateTheme(String themeName)

---------(end of error message text)----------------

Re: CodeGen error in v1.10.2 $20 PayPal Bounty

I found a workaround posted on StackOverflow: https://stackoverflow.com/questions/39804581/creating-new-theme-in-orchard-with-codegeneration-module

Change line # 434 in the CodeGenerationCommands.cs file: - remove "\r" from line.

Original line: solutionText = solutionText.Insert(solutionText.LastIndexOf("EndProject\r\n"), projectReference); Changed line : solutionText = solutionText.Insert(solutionText.LastIndexOf("EndProject\n"), projectReference);

Friday, October 6, 2017 6:12:32 AM byRichH
  • RichH
  • Lv. 01 Rookie
  • Total EXP: 4

Re: CodeGen error in v1.10.2 $20 PayPal Bounty

Sebastion sent me an email asking me for details and I told him that I downloaded the .zip file -- I did not clone the source code.

I also told him about the workaround to solve the problem.

He could not find this problem in the cloned code; but he did find it in the code in the .zip file. He said that they would fix the problem in the .zip file (which did have the problem).

Thanks Sebastion.

Friday, October 6, 2017 6:16:32 AM byRichH
  • RichH
  • Lv. 01 Rookie
  • Total EXP: 4

Post a reply

You need to be signed in to post a reply.

Sign In