question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

System.ArgumentException: The UNC path should be of the form \\\\server\\share.

See original GitHub issue

Hi , I just simply use the default Razor Renderer send email function, following are my snippet code. But I get an exception error “The UNC path should be of the form \\server\share…”

Any idea? Please help, thanks.

` Email.DefaultRenderer = new RazorRenderer();

            var template = "Dear @Model.Name, You are totally @Model.Compliment.";

            var email = Email
                .From("myemail@gmail.com")
                .To("destination@gmail.com")
                .Subject("woo nuget")
                .UsingTemplate(template, new { Name = "Luke", Compliment = "Awesome" });

            await email.SendAsync();`

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ampd18commented, Mar 23, 2018

Hello, I was able to solve the problem by following these steps: First I will paste the original code and comment on it the modifications I made.

Original code: On Git [My changes] Add the sender before creating an instance of the “Email” class As you can see the error was only in the order in which the values ​​were placed.

Declaration order

1º) // Using Razor templating package Email.DefaultRenderer = new RazorRenderer();

2º) // Using Smtp Sender package Email.DefaultSender = new SmtpSender(new smtpClient { host = “”, …});

3º) var template = “Dear @Model.Name, You are totally @Model.Compliment.”;

(Note the variable created below) var _email = Email .From(“bob@hotmail.com”) .To(“somedude@gmail.com”) .Subject(“woo nuget”) .UsingTemplate(template, new { Name = “Luke”, Compliment = “Awesome” });

//send normally _email.Send();

It is not possible to add a default value after the class has already been instantiated.

With these fixes, it works without errors

0reactions
lukencodecommented, Apr 25, 2018

Hi all,

I am closing this issue. I think the solution is explained above - ensure the sender has been setup correctly before calling Email.From…

Read more comments on GitHub >

github_iconTop Results From Across the Web

`The UNC path should be of the form \\server\share` when ...
The UNC path should be of the form \\server\share when importing directly from UNC shared folder #4943.
Read more >
Get a list of all UNC shared folders on a local network server
Unhandled Exception: System.ArgumentException: The UNC path should be of the form \server\share. Is there a way to get a list all shared ...
Read more >
The UNC path should be of the form \\server\share.
The UNC path should be of the form \\server\share. Description: An unhandled exception occurred during the execution of the current web request.
Read more >
The UNC path should be of the form \\server\share. : DTRC-6056
Message = “The UNC path should be of the form \\server\share.” ExceptionPath = Root.InnerException ClassName = System.ArgumentException
Read more >
Support of the \\?\UNC\server\share syntax in Windows
1 Answer 1 ... The \\?\UNC\server\share\path\file syntax is only valid for single file commands such as CreateFile, GetFileAttributesEx, ... and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found