By on 11/12/2015 7:43 AM ()

Sorry, I couln't reproduce (used this exact code in a UI.Next SPA template, only added the opens). But this error happens only when a System.Activator.CreateInstance on the macro type throws a MissingMethodException. So for some reason, the parameterless constructor on your ConfigMacro type is missing or not public. Can you check with ILSpy on the dll in the obj folder? (not copied because WS task failed)

By on 10/29/2015 7:56 AM ()

Hi Andras,

Here is what I see from ILSpy:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
	[CompilationMapping(SourceConstructFlags.Module)]
	public static class Macro
	{
		[CompilationMapping(SourceConstructFlags.ObjectType)]
		[Serializable]
		public class ConfigMacro : Macros.IMacro
		{
			public ConfigMacro() : this()
			{
			}

			Core.Expression Macros.IMacro.WebSharper-Core-Macros-IMacro-Translate(Quotations.Expression q, FSharpFunc<Quotations.Expression, Core.Expression> tr)
			{
				return Core.Literal.op_BangTwiddle(Core.Literal.NewString("Test"));
			}
		}

		[Attributes.MacroAttribute(typeof(Macro.ConfigMacro))]
		public static string Config()
		{
			return Pervasives.X<string>();
		}
	}

When compiling with Visual studio, the W# JS compiles fine but only when I clean the solution and build using FAKE, it throws the no default constructor error.

I have pasted a gist of all my code here

By on 11/2/2015 1:19 AM ()

When I build the solution from visual studio, it will compile properly.

I am not sure but it seems to be related to the fact that I compile with MSBuild. Using this command: "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" /property:SolutionDir="C:\Projects\MacroTest" will yield the same error.

By on 11/4/2015 7:14 AM ()

Does removing the private access modifier help?

By on 10/27/2015 1:57 PM ()

Unfortunately It doesn't change. The error remains the same. error : ConfigMacro: error: No default constructor.

By on 10/28/2015 8:29 AM ()

Any clue on this?

By on 10/27/2015 2:14 AM ()

.

By on 10/27/2015 2:01 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper