spMFCheckAndUpdateAssemblyVersion

Signature

EXEC dbo.spMFCheckAndUpdateAssemblyVersion
    @Debug = 0;
Returns
  • 1 = Success

Parameters
@processBatch_ID int (optional)
  • Existing ProcessBatch log ID to append detail rows to. If NULL (default), this procedure opens a new batch and closes it. ProcessBatch logging only persists when MFSettings.App_DetailLogging > 0; otherwise it is a no-op.

@Debug int (optional)
  • Default = 0

  • 1 = Standard Debug Mode

Purpose

Scheduled daily health check for the CLR assembly stack. Called by the MFSQL Validate M-Files Version SQL Agent job.

Detects whether the M-Files client version on this server has changed since the last assembly reload. If a version mismatch is found, calls spMFUpdateAssemblies to dynamically detect the new installation path (Change 8) and reload all CLR and Interop assemblies.

Detection uses registry enumeration (xp_regenumkeys / xp_regread) to read the latest installed M-Files version - no CLR dependency, so the check is safe even when assemblies are in a degraded state.

Version-check and reload events are logged to MFProcessBatch / MFProcessBatchDetail for audit (when App_DetailLogging is enabled). On failure, the error is also written to dbo.MFLog, which triggers the existing email alert mechanism - MFLog remains the fatal/alerting path regardless of detail-logging state.

This procedure is the scheduled fallback for installations where the WMI Event Alert (Change 11) is not available (e.g. SQL Express) or in the unlikely event an alert firing is missed.

Warnings

SQL Server Agent required. This procedure is called by a scheduled Agent job (MFSQL Validate M-Files Version). On SQL Express installations no scheduled job exists; call dbo.spMFUpdateAssemblies directly after every M-Files upgrade.

Changelog

Date

Author

Description

2026-05-27

AC

Wire up @processBatch_ID: log version-check/reload to MFProcessBatch + MFProcessBatchDetail; MFLog remains the fatal/email path; set MFilesUpdatePending on change (Issue #41)

2026-04-22

AC

Restore version-mismatch detection; call spMFUpdateAssemblies on change; TRY/CATCH writes to MFLog on failure (Issue #41)

2026-03-25

AC

Stub out as deprecated no-op (superseded by 2026-04-22 entry)

2023-06-28

LC

Fix bug with assembly version

2023-05-30

LC

Add additional logging to track process results

2022-11-03

LC

Include validation that assemblies are in place

2021-12-16

LC

Fix bug to stop continious updates when no change took place

2021-08-11

LC

Improve control when version could not be found

2020-10-27

LC

Improve error message

2019-08-30

JC

Added documentation

2019-07-25

LC

Add more debug and error trapping, fix issue to prevent update

2019-05-19

LC

Fix bug - insert null value in MFsettings not allowed

2018-09-27

LC

Change procedure to work with Release 4 scripts

2016-12-28

DEV2

Create Procedure