Missing resource exception involving namespace and .net 4 vs. .net6

Posted by: lit on 15 November 2023, 9:19 am EST

    • Post Options:
    • Link

    Posted 15 November 2023, 9:19 am EST

    We have a visual studio project for AR, sdk-style, that targets both .net6 and net48. In the .net 6 assembly, embedded resources for reports have the full namespace name, e.g.,

    CBORD.Fms.Reports.AccountsPayablePreExportMasterReport.resources

    in the .net 4.8 assembly, the embedded resource has a partial name, e.g.,

    Reports.AccountsPayablePreExportMasterReport.resources

    We have a test, using nunit, running in .Net Framework 4.8, that runs successfully on one system, but on another it fails with System.Resources.MissingManifestResourceException

    *Could not find any resources appropriate for the specified culture or the neutral culture.

    Make sure “CBORD.Fms.Reports.PostVendorItemUpdate.resources” was correctly embedded or linked into assembly “Reports” *

    Note that it is looking for the resource with the full name, but the .net 4.8 assembly does not have fullnamed resource.

    We don’t know why this ever succeeds, but we need to fix the failure. WHat’s up with this? Thanks.

    P.S. Sitemasters, it’s surprising that the forum would not allow me to put “MissingManifestResourceException” in the title because the word is too long. Sometimes we have to use big words. :slight_smile:

  • Posted 15 November 2023, 9:43 pm EST

    Hi Leo,

    ActiveReports version 6 and lower are legacy version of ActiveReports and we no longer provide any support for the same. I would suggest you to upgrade to the latest version of ActiveReports i.e. ActiveReports 17.2 and if the issue persists then please share a runnable sample application reproducing the issue so we can test this at our end and get back to you accordingly.

    You may download the latest version of ActiveReports using the following link: Download ActiveReports 17

  • Posted 16 November 2023, 1:52 am EST

    I’m sorry, I neglected to mention the version of AR that we are using.

    We are using AR 16.3. In my question, I mentioned .net 6, because I see a difference in the results when using .net 6 vs .net 4.8.

    We can’t upgrade to 17 at this time.

    Could you please re-evalauate my question in the context of AR 16?

    Thanks.

  • Posted 16 November 2023, 6:19 pm EST

    Hi Leo

    Could you please make sure the resource file is dependent to the Section Report class script file? Please check the sample code:

    project.csproj file


      <ItemGroup>
        <EmbeddedResource Include="SectionReport1.resx">
          <DependentUpon>SectionReport1.cs</DependentUpon>
        </EmbeddedResource>
      </ItemGroup>
    
    

    You may also set the EnableDefaultEmbeddedResourceItems property to true by adding the following lines of code:

    project.csproj file


    <PropertyGroup>
        <EnableDefaultEmbeddedResourceItems>true</EnableDefaultEmbeddedResourceItems>
    </PropertyGroup>
    

    If the issue persists then please share a sample project reproducing the issue with some steps to reproduce it.

  • Posted 20 November 2023, 5:18 pm EST

    ReportsRepro.zip

    I’ve uploaded a repro. Open the solution “ReportsRepro.sln”

    There are three projects: one that defines the report, one that runs it in .net 48,

    and one that runs it in .net 6.

    1. Build.
    2. Go to a command line.

    run {solutionroot}\RunReport60\bin\debug\net60\RunReport60.exe. See “success”

    4.

    run {solutionroot}\RunReport48\bin\debug\RunReport48.exe. See MissingManifestResourceException.

    I look forward to your response.

  • Posted 21 November 2023, 3:35 pm EST

    Hi,

    could you give me some assurance that somebody is looking at this?

    Thanks.

  • Posted 21 November 2023, 5:20 pm EST

    Hi Leo,

    The issue is due to the inconsistency between the namespace names. Set the Default Namespace as CBORD.Fms.Reports and you’ll be good to go. For that, right-click the Reports project, go to Properties and change the Default Namespace.

    You may also refer to the below Stackoverflow link regarding the same:

    Attachment: ReportsRepro_Updated.zip

  • Posted 23 November 2023, 12:45 pm EST

    Thanks, that resolved the issue.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels