Error Running transformation: System.NullReferenceException:

Jan 10, 2013 at 4:24 PM

Can you help with the following error with Latest download. 

it worked fine when i run sample EF4templates solution.. I wanted to try my own on new solution

I added EF4template through NUget Package and created sample edmx with one table.

and assigned it in

T4Config.Name = @"Model1.edmx";

When i save this is the error i get

Error 1 Running transformation: System.NullReferenceException: Object reference not set to an instance of an object.   at Microsoft.VisualStudio.TextTemplatingD8E937F3D8CB11BD81DFFEDDFB7E3405A6DC0F6271FFA1A0B4FE37F3DEEE43CA252854662B99BB523B4BCC0D5C422B6FBE7097AF71D4DE80B1BF4ADDD609BD37.GeneratedTextTransformation.Ef4EdmxParser.ParseEdmxDocument(XElement edmx) in

..\CodeTemplates\Ef4Gen\EdmxParser.ttinclude:line 140 

 at Microsoft.VisualStudio.TextTemplatingD8E937F3D8CB11BD81DFFEDDFB7E3405A6DC0F6271FFA1A0B4FE37F3DEEE43CA252854662B99BB523B4BCC0D5C422B6FBE7097AF71D4DE80B1BF4ADDD609BD37.GeneratedTextTransformation.Ef4EdmxParser.ParseEdmxFromFile(String fileName) in

..\CodeTemplates\Ef4Gen\EdmxParser.ttinclude:line 118   at Microsoft.VisualStudio.TextTemplatingD8E937F3D8CB11BD81DFFEDDFB7E3405A6DC0F6271FFA1A0B4FE37F3DEEE43CA252854662B99BB523B4BCC0D5C422B6FBE7097AF71D4DE80B1BF4ADDD609BD37.GeneratedTextTransformation.T4Gen.Validate()

in ..\CodeTemplates\Ef4Gen\T4Generator.ttinclude:line 226   at T4Toolbox.Generator.Run()   at Microsoft.VisualStudio.TextTemplatingD8E937F3D8CB11BD81DFFEDDFB7E3405A6DC0F6271FFA1A0B4FE37F3DEEE43CA252854662B99BB523B4BCC0D5C422B6FBE7097AF71D4DE80B1BF4ADDD609BD37.GeneratedTextTransformation.TransformText() in

..\CodeTemplates\Ef4Gen\ 64

..\CodeTemplates\Ef4Gen\EdmxParser.ttinclude 140

Jan 11, 2013 at 3:36 AM

It means it can't parse the edmx file. Maybe the filename is incorrect, or the wrong path. You could add the full path to it, e.g. "C:\temp\mymodel.edmx" etc.

Jan 11, 2013 at 4:08 AM

It could also mean there is something wrong with your model, can you create a different model, add a table to it, and then generate it?

Jan 11, 2013 at 9:41 PM

Thank you for your response

Well,i gave full path and it still gives me same error. I only way i was able to make it work was using your sample soultion EF4Templates. if I add my *.edmx then it would work in your sample app.

Which brings me to ask another question that there anything else that i should do ..other than just giving it a path? when i am using a new solution.

Feb 6, 2013 at 6:58 PM
I don't know. if *.edmx works, or full path, then that's the solution.
Apr 1, 2013 at 10:02 AM
See a possible solution to this in the following discussion thread: