No Implementation part for Partial Method

I've taken the Github sample:

C:\Temp\DocIO-Examples-main\Getting-Started\.NET-MAUI\Create-Word-document\ to use in my .NET Maui app. 

The demo project compiles and runs correctly, however, when I run my app, I'm getting the follwing error.

Partial method 'SaveService.SaveAndView(string, string, MemoryStream)' must have an implementation part because it has accessibility modifiers.

Here is my Save Service class:

using System.IO;

using System.Threading.Tasks;


namespace Create_Word_document.Services
{
    public partial class SaveService
    {
        //Method to save document as a file and view the saved document.
        public partial void SaveAndView(string filename, string contentType, MemoryStream stream);


    }
}



And here is the calling function.


        using MemoryStream ms = new();

        //Saves the Word document to the memory stream.
        document.Save(ms, FormatType.Docx);
        ms.Position = 0;
        //Saves the memory stream as file.
        SaveService saveService = new();
        saveService.SaveAndView("Sample.docx", "application/msword", ms);


I've checked everything but the versions of the Synfusion DocIO NuGet packages.



1 Reply

DS Dharanya Sakthivel Syncfusion Team August 26, 2024 11:13 AM UTC

Hi Frederick,

We suspect that the error you're encountering “Partial method 'SaveService.SaveAndView(string, string, MemoryStream)' must have an implementation part because it has accessibility modifiers” is because the partial method SaveAndView has been declared with accessibility modifiers (public in this case), but it doesn't have an implementation in the project.

To resolve this issue, you need to provide an implementation for the SaveAndView method. Depending on your platform (e.g. for, Windows , iOS, Android, MacCatalyst ) you can refer the GitHub sample and implement the partial method SaveAndView in your sample application.

Regards,
Dharanya.




Loader.
Up arrow icon