SharpSwift icon indicating copy to clipboard operation
SharpSwift copied to clipboard

sharpswift.exe "plc.cs" does not work

Open AxelStallknecht opened this issue 9 years ago • 1 comments
trafficstars

Hi, I want check this program out, but I get an error message if I do a sharpswift.exe "plc.cs". Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. at SharpSwift.Program.ParseFile(String path, String solutionPath, Boolean doIndent) in C:\Users\stalle.JM\Downloads\SharpSwift-master\SharpSwift\SharpSwift\Program.cs:line 62 at SharpSwift.Program.Main(String[] args) in C:\Users\stalle.JM\Downloads\SharpSwift-master\SharpSwift\SharpSwift\Program.cs:line 27

The error comes because it's not soluation file available. var doc = GetDocumentFromSolution(solutionPath, path); var tree = doc.GetSyntaxTreeAsync().Result;

So...the var doc becomes null and "var tree..." crashes. Do you have a solution ?

BR Axel

AxelStallknecht avatar Aug 18 '16 13:08 AxelStallknecht

Hello! Thanks for checking the project out :)

If I understand your issue correctly, could you make sure that your .cs file is part of a solution (and that the .sln file is somewhere nearby in the folder tree)? I haven't worked on this for a few months so it's possible there are other issues with it (or that Roslyn has made breaking changes since then).

The README should probably be updated to specify this, but yes, it does require the .cs file be a part of a solution.

Let me know if I've misunderstood the issue!

Thanks, Matthew

PS: By all means feel free to use this/check it out, but on the chance you're attempting to write OSX/iOX code on Windows, it's also worth mentioning that since I first started work on this Xamarin has become free!

matthewsot avatar Aug 19 '16 00:08 matthewsot