2) Is there is anyway to throw a exception from Lisp functions to dotnet when i invoking that lisp function from dotnet.
You can't throw exceptions from LISP that can be caught by calling
.NET code.
If you use acedInvoke(), you will get an error result code if a call
to a LISP function resulted in an error, and that doesn't tell you
much about what exactly happened.
You could try calling vl-exit-with-error to raise an error from a
called LISP function (never tried that), and see what acedInvoke()
returns.
You could also define a LISP wrapper function that your .NET code
calls via acedInvoke(), which passes the actual LISP function that
you want to call as a string, and then have it catch any error that
gets thrown and conveys it back to the calling .NET code.
;; (untested)
(defun invoke-wrapper( func arglist / result )
(setq *invoke-error* nil)
(setq result (vl-catch-all-apply (read func) arglist))
(if (vl-catch-all-error-p result)
(progn
(setq *invoke-error* (vl-catch-all-error-message result))
(vl-exit-with-error *invoke-error*)
)
result
)
)